Skip to content

Commit

Permalink
Add more official pre-commit hooks (#255)
Browse files Browse the repository at this point in the history
* Add 4 more official pre-commit hooks

https://github.com/pre-commit/pre-commit-hooks

* Fix mixed line endings in `cxx` and `hxx` in `main`
  • Loading branch information
jbampton authored Jan 28, 2025
1 parent 033ed79 commit 36d8fc7
Show file tree
Hide file tree
Showing 53 changed files with 1,449 additions and 1,440 deletions.
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ repos:
hooks:
- id: identity
- id: check-hooks-apply
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-illegal-windows-names
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: mixed-line-ending
files: ^main/.*\.(c|h)xx$
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
2 changes: 1 addition & 1 deletion main/basegfx/source/polygon/b2dlinegeometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/curve/b2dcubicbezier.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/LineCap.hpp>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>

//////////////////////////////////////////////////////////////////////////////
Expand Down
70 changes: 35 additions & 35 deletions main/cui/source/uno/services/services.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,38 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"

#include <com/sun/star/registry/XRegistryKey.hpp>
#include "sal/types.h"
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implementationentry.hxx>

using rtl::OUString;
using namespace com::sun::star;

namespace cui {
extern rtl::OUString SAL_CALL ColorPicker_getImplementationName();
extern uno::Reference< uno::XInterface > SAL_CALL ColorPicker_createInstance( uno::Reference< uno::XComponentContext > const & ) SAL_THROW( (uno::Exception) );
extern uno::Sequence< rtl::OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( uno::RuntimeException );
}

namespace
{

cppu::ImplementationEntry entries[] = {
{ &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, 0, 0 },
{ 0, 0, 0, 0, 0, 0 }
};
}

extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey)
{
return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries);
}


extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

// eof
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "sal/types.h"
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implementationentry.hxx>

using rtl::OUString;
using namespace com::sun::star;

namespace cui {
extern rtl::OUString SAL_CALL ColorPicker_getImplementationName();
extern uno::Reference< uno::XInterface > SAL_CALL ColorPicker_createInstance( uno::Reference< uno::XComponentContext > const & ) SAL_THROW( (uno::Exception) );
extern uno::Sequence< rtl::OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( uno::RuntimeException );
}

namespace
{

cppu::ImplementationEntry entries[] = {
{ &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, 0, 0 },
{ 0, 0, 0, 0, 0, 0 }
};
}

extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey)
{
return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries);
}


extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

// eof
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,11 @@ namespace drawinglayer
// this is solved by applying fixed values additionally to luminance
// and contrast, do it here and reset DrawMode to GRAPHICDRAWMODE_STANDARD
// original in svtools uses:
// #define WATERMARK_LUM_OFFSET 50
// #define WATERMARK_CON_OFFSET -70
fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0);
fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0);
aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD;
// #define WATERMARK_LUM_OFFSET 50
// #define WATERMARK_CON_OFFSET -70
fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0);
fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0);
aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD;
}

// DrawMode (GRAPHICDRAWMODE_WATERMARK already handled)
Expand Down
2 changes: 1 addition & 1 deletion main/filter/source/msfilter/eschesdo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ basegfx::B2DRange getUnrotatedGroupBoundRange(const Reference< XShape >& rxShape

if(mXPropSet.is())
{
const Any aAny = mXPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")));
const Any aAny = mXPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")));

if(aAny.hasValue())
{
Expand Down
2 changes: 1 addition & 1 deletion main/sc/source/ui/view/cellsh4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
pTabViewShell->HideAllCursors();

// i123629
if( pTabViewShell->GetCurObjectSelectionType() == OST_Editing )
if( pTabViewShell->GetCurObjectSelectionType() == OST_Editing )
pTabViewShell->SetForceFocusOnCurCell(sal_True);
else
pTabViewShell->SetForceFocusOnCurCell(sal_False);
Expand Down
82 changes: 41 additions & 41 deletions main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/

#ifndef SFX_SIDEBAR_POPUP_CONTAINER_HXX
#define SFX_SIDEBAR_POPUP_CONTAINER_HXX

#include "sfx2/dllapi.h"
#include <vcl/floatwin.hxx>

namespace sfx2 { namespace sidebar {

class SFX2_DLLPUBLIC PopupContainer : public FloatingWindow
{
public:
PopupContainer (Window* pParent);
virtual ~PopupContainer (void);

virtual long Notify (NotifyEvent& rNEvt);
};

} } // end of namespace sfx2::sidebar

#endif
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/

#ifndef SFX_SIDEBAR_POPUP_CONTAINER_HXX
#define SFX_SIDEBAR_POPUP_CONTAINER_HXX

#include "sfx2/dllapi.h"
#include <vcl/floatwin.hxx>

namespace sfx2 { namespace sidebar {

class SFX2_DLLPUBLIC PopupContainer : public FloatingWindow
{
public:
PopupContainer (Window* pParent);
virtual ~PopupContainer (void);

virtual long Notify (NotifyEvent& rNEvt);
};

} } // end of namespace sfx2::sidebar

#endif
108 changes: 54 additions & 54 deletions main/sfx2/source/sidebar/PopupContainer.cxx
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/

#include "precompiled_sfx2.hxx"

#include "sfx2/sidebar/PopupContainer.hxx"

namespace sfx2 { namespace sidebar {

PopupContainer::PopupContainer (Window* pParent)
: FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK)
{
}




PopupContainer::~PopupContainer (void)
{
}




long PopupContainer::Notify (NotifyEvent& rEvent)
{
if (rEvent.GetType() == EVENT_LOSEFOCUS)
{
if( ! HasChildPathFocus(sal_True))
EndPopupMode();
}
return FloatingWindow::Notify(rEvent);
}


} } // end of namespace sfx2::sidebar
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/

#include "precompiled_sfx2.hxx"

#include "sfx2/sidebar/PopupContainer.hxx"

namespace sfx2 { namespace sidebar {

PopupContainer::PopupContainer (Window* pParent)
: FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK)
{
}




PopupContainer::~PopupContainer (void)
{
}




long PopupContainer::Notify (NotifyEvent& rEvent)
{
if (rEvent.GetType() == EVENT_LOSEFOCUS)
{
if( ! HasChildPathFocus(sal_True))
EndPopupMode();
}
return FloatingWindow::Notify(rEvent);
}


} } // end of namespace sfx2::sidebar
Loading

0 comments on commit 36d8fc7

Please sign in to comment.