.clang-format | 1 include/svx/ClassificationCommon.hxx | 48 +- include/test/sheet/xsheetcellrange.hxx | 1 include/test/sheet/xsheetcellrangecontainer.hxx | 1 include/test/sheet/xsheetcellranges.hxx | 1 include/test/sheet/xsheetcondition.hxx | 1 include/test/sheet/xsheetconditionalentries.hxx | 1 include/test/sheet/xsheetconditionalentry.hxx | 1 include/tools/XmlWalker.hxx | 4 include/tools/XmlWriter.hxx | 6 sc/qa/extras/sctableconditionalentryobj.cxx | 31 - sc/qa/extras/sctableconditionalformatobj.cxx | 35 - sc/qa/extras/sctablevalidationobj.cxx | 23 svx/source/dialog/ClassificationCommon.cxx | 53 +- test/source/sheet/xsheetcellrange.cxx | 1 test/source/sheet/xsheetcellrangecontainer.cxx | 1 test/source/sheet/xsheetcellranges.cxx | 1 test/source/sheet/xsheetcondition.cxx | 1 test/source/sheet/xsheetconditionalentries.cxx | 1 test/source/sheet/xsheetconditionalentry.cxx | 1 tools/source/xml/XmlWalker.cxx | 25 - tools/source/xml/XmlWriter.cxx | 25 - vcl/inc/qt5/Qt5Font.hxx | 13 vcl/qt5/Qt5Bitmap.cxx | 157 ++---- vcl/qt5/Qt5Bitmap.hxx | 52 +- vcl/qt5/Qt5Data.cxx | 255 +++++----- vcl/qt5/Qt5Data.hxx | 6 vcl/qt5/Qt5Font.cxx | 4 vcl/qt5/Qt5FontFace.cxx | 80 +-- vcl/qt5/Qt5FontFace.hxx | 30 - vcl/qt5/Qt5Frame.cxx | 413 +++++++---------- vcl/qt5/Qt5Frame.hxx | 152 +++--- vcl/qt5/Qt5Graphics.cxx | 51 -- vcl/qt5/Qt5Graphics.hxx | 287 +++++------- vcl/qt5/Qt5Graphics_Controls.cxx | 29 - vcl/qt5/Qt5Graphics_GDI.cxx | 573 +++++++++++------------- vcl/qt5/Qt5Graphics_Text.cxx | 111 ++-- vcl/qt5/Qt5Instance.cxx | 256 ++++------ vcl/qt5/Qt5Instance.hxx | 85 +-- vcl/qt5/Qt5Instance_Print.cxx | 210 ++++---- vcl/qt5/Qt5Object.cxx | 52 -- vcl/qt5/Qt5Object.hxx | 26 - vcl/qt5/Qt5Painter.cxx | 42 - vcl/qt5/Qt5Painter.hxx | 26 - vcl/qt5/Qt5Printer.cxx | 9 vcl/qt5/Qt5Printer.hxx | 4 vcl/qt5/Qt5Timer.cxx | 33 - vcl/qt5/Qt5Timer.hxx | 4 vcl/qt5/Qt5Tools.cxx | 23 vcl/qt5/Qt5Tools.hxx | 70 +- vcl/qt5/Qt5VirtualDevice.cxx | 60 +- vcl/qt5/Qt5VirtualDevice.hxx | 22 vcl/qt5/Qt5Widget.cxx | 339 ++++++++------ vcl/qt5/Qt5Widget.hxx | 37 - vcl/qt5/tst_exclude_posted_events.hxx | 37 - vcl/qt5/tst_exclude_socket_notifiers.hxx | 58 +- vcl/source/helper/errcode.cxx | 163 +++++- vcl/workben/scrtffuzzer.cxx | 16 vcl/workben/xlsfuzzer.cxx | 16 59 files changed, 1958 insertions(+), 2106 deletions(-)
New commits: commit b536e10390c171e96b6477c04d66023a1da543c4 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 8 11:28:04 2017 +0100 Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-format ...even if that can cause reformatting of already formatted code. The problem I came across is that without this something like > namespace { > > void f1(); > > void f2(); > > } (which is quite a common style in the current code base) would be changed to > namespace > { > > void f1(); > > void f2(); > } instead of > namespace > { > void f1(); > > void f2(); > } and I found no other clang-format style option that would result in the presence or absence of an empty line be identical at the start and end of the namespace block. vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the same time, so this commit includes that. Some of those new files had not been formatted at all, so this commit includes their full reformatting changes. Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c Reviewed-on: https://gerrit.libreoffice.org/44450 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/.clang-format b/.clang-format index 338e8d627121..797f22404a09 100644 --- a/.clang-format +++ b/.clang-format @@ -16,6 +16,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: false DerivePointerBinding: false ExperimentalAutoDetectBinPacking: false IndentCaseLabels: true +KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCSpaceBeforeProtocolList: true diff --git a/include/svx/ClassificationCommon.hxx b/include/svx/ClassificationCommon.hxx index 2276c962532d..eb8d864ff21b 100644 --- a/include/svx/ClassificationCommon.hxx +++ b/include/svx/ClassificationCommon.hxx @@ -18,27 +18,33 @@ #include <sfx2/classificationhelper.hxx> #include <com/sun/star/beans/XPropertyContainer.hpp> -namespace svx { -namespace classification { - -SVX_DLLPUBLIC OUString convertClassificationResultToString(std::vector<svx::ClassificationResult> const & rResults); - -SVX_DLLPUBLIC OUString getProperty(css::uno::Reference<css::beans::XPropertyContainer> const & rxPropertyContainer, - OUString const & rName); - -SVX_DLLPUBLIC bool containsProperty(css::uno::Sequence<css::beans::Property> const & rProperties, - OUString const & rName); - -SVX_DLLPUBLIC void removeAllProperties(css::uno::Reference<css::beans::XPropertyContainer> const & rxPropertyContainer); - -SVX_DLLPUBLIC bool addOrInsertDocumentProperty(css::uno::Reference<css::beans::XPropertyContainer> const & rxPropertyContainer, - OUString const & rsKey, OUString const & rsValue); - -SVX_DLLPUBLIC void insertFullTextualRepresentationAsDocumentProperty(css::uno::Reference<css::beans::XPropertyContainer> const & rxPropertyContainer, - sfx::ClassificationKeyCreator const & rKeyCreator, - std::vector<svx::ClassificationResult> const & rResults); - -}} // end svx::classification namespace +namespace svx +{ +namespace classification +{ +SVX_DLLPUBLIC OUString +convertClassificationResultToString(std::vector<svx::ClassificationResult> const& rResults); + +SVX_DLLPUBLIC OUString +getProperty(css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer, + OUString const& rName); + +SVX_DLLPUBLIC bool containsProperty(css::uno::Sequence<css::beans::Property> const& rProperties, + OUString const& rName); + +SVX_DLLPUBLIC void +removeAllProperties(css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer); + +SVX_DLLPUBLIC bool addOrInsertDocumentProperty( + css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer, + OUString const& rsKey, OUString const& rsValue); + +SVX_DLLPUBLIC void insertFullTextualRepresentationAsDocumentProperty( + css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer, + sfx::ClassificationKeyCreator const& rKeyCreator, + std::vector<svx::ClassificationResult> const& rResults); +} +} // end svx::classification namespace #endif // INCLUDED_SVX_CLASSIFICATIONCOMMON_HXX diff --git a/include/test/sheet/xsheetcellrange.hxx b/include/test/sheet/xsheetcellrange.hxx index 5f44d21dd0dd..42ce2d094c4c 100644 --- a/include/test/sheet/xsheetcellrange.hxx +++ b/include/test/sheet/xsheetcellrange.hxx @@ -17,7 +17,6 @@ namespace apitest { - class OOO_DLLPUBLIC_TEST XSheetCellRange { public: diff --git a/include/test/sheet/xsheetcellrangecontainer.hxx b/include/test/sheet/xsheetcellrangecontainer.hxx index f87d80a78a47..8164da251975 100644 --- a/include/test/sheet/xsheetcellrangecontainer.hxx +++ b/include/test/sheet/xsheetcellrangecontainer.hxx @@ -20,7 +20,6 @@ namespace apitest { - class OOO_DLLPUBLIC_TEST XSheetCellRangeContainer { public: diff --git a/include/test/sheet/xsheetcellranges.hxx b/include/test/sheet/xsheetcellranges.hxx index 2024ec5f25e9..4f21f446c21f 100644 --- a/include/test/sheet/xsheetcellranges.hxx +++ b/include/test/sheet/xsheetcellranges.hxx @@ -17,7 +17,6 @@ namespace apitest { - class OOO_DLLPUBLIC_TEST XSheetCellRanges { public: diff --git a/include/test/sheet/xsheetcondition.hxx b/include/test/sheet/xsheetcondition.hxx index c25eae86858c..c69625f445de 100644 --- a/include/test/sheet/xsheetcondition.hxx +++ b/include/test/sheet/xsheetcondition.hxx @@ -17,7 +17,6 @@ namespace apitest { - class OOO_DLLPUBLIC_TEST XSheetCondition { public: diff --git a/include/test/sheet/xsheetconditionalentries.hxx b/include/test/sheet/xsheetconditionalentries.hxx index 25a51325ea87..673e7ceb1784 100644 --- a/include/test/sheet/xsheetconditionalentries.hxx +++ b/include/test/sheet/xsheetconditionalentries.hxx @@ -20,7 +20,6 @@ namespace apitest { - class OOO_DLLPUBLIC_TEST XSheetConditionalEntries { public: diff --git a/include/test/sheet/xsheetconditionalentry.hxx b/include/test/sheet/xsheetconditionalentry.hxx index 775c55b5858b..d143f784342e 100644 --- a/include/test/sheet/xsheetconditionalentry.hxx +++ b/include/test/sheet/xsheetconditionalentry.hxx @@ -17,7 +17,6 @@ namespace apitest { - class OOO_DLLPUBLIC_TEST XSheetConditionalEntry { public: diff --git a/include/tools/XmlWalker.hxx b/include/tools/XmlWalker.hxx index 4d4bc88f363c..85507f46583d 100644 --- a/include/tools/XmlWalker.hxx +++ b/include/tools/XmlWalker.hxx @@ -14,8 +14,8 @@ #include <tools/stream.hxx> #include <memory> -namespace tools { - +namespace tools +{ struct XmlWalkerImpl; /** diff --git a/include/tools/XmlWriter.hxx b/include/tools/XmlWriter.hxx index c454f4139803..15a3a0013912 100644 --- a/include/tools/XmlWriter.hxx +++ b/include/tools/XmlWriter.hxx @@ -14,8 +14,8 @@ #include <tools/stream.hxx> #include <memory> -namespace tools { - +namespace tools +{ struct XmlWriterImpl; /** @@ -31,8 +31,8 @@ class TOOLS_DLLPUBLIC XmlWriter final { private: std::unique_ptr<XmlWriterImpl> mpImpl; -public: +public: XmlWriter(SvStream* pStream); ~XmlWriter(); diff --git a/sc/qa/extras/sctableconditionalentryobj.cxx b/sc/qa/extras/sctableconditionalentryobj.cxx index 4895d03dc9e1..ad39a74ef20e 100644 --- a/sc/qa/extras/sctableconditionalentryobj.cxx +++ b/sc/qa/extras/sctableconditionalentryobj.cxx @@ -33,8 +33,8 @@ using namespace css; using namespace css::uno; using namespace com::sun::star; -namespace sc_apitest { - +namespace sc_apitest +{ #define NUMBER_OF_TESTS 5 class ScTableConditionalEntryObj : public CalcUnoApiTest, @@ -44,7 +44,7 @@ class ScTableConditionalEntryObj : public CalcUnoApiTest, public: ScTableConditionalEntryObj(); - virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference<uno::XInterface> init() override; virtual void setUp() override; virtual void tearDown() override; @@ -63,39 +63,39 @@ public: private: static sal_Int32 nTest; - static uno::Reference< lang::XComponent > mxComponent; - + static uno::Reference<lang::XComponent> mxComponent; }; sal_Int32 ScTableConditionalEntryObj::nTest = 0; -uno::Reference< lang::XComponent > ScTableConditionalEntryObj::mxComponent; +uno::Reference<lang::XComponent> ScTableConditionalEntryObj::mxComponent; ScTableConditionalEntryObj::ScTableConditionalEntryObj() : CalcUnoApiTest("/sc/qa/extras/testdocuments") { } -uno::Reference< uno::XInterface > ScTableConditionalEntryObj::init() +uno::Reference<uno::XInterface> ScTableConditionalEntryObj::init() { // create a calc document if (!mxComponent.is()) mxComponent = loadFromDesktop("private:factory/scalc"); - uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); - uno::Reference< container::XIndexAccess > xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); xSheet->getCellByPosition(5, 5)->setValue(15); xSheet->getCellByPosition(1, 4)->setValue(10); xSheet->getCellByPosition(2, 0)->setValue(-5.15); - uno::Reference< beans::XPropertySet > xPropSet(xSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSheetConditionalEntries > xSheetConditionalEntries; - xSheetConditionalEntries.set(xPropSet->getPropertyValue(SC_UNONAME_CONDFMT), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropSet(xSheet, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntries> xSheetConditionalEntries; + xSheetConditionalEntries.set(xPropSet->getPropertyValue(SC_UNONAME_CONDFMT), + uno::UNO_QUERY_THROW); - uno::Sequence< beans::PropertyValue > aPropValue(5); + uno::Sequence<beans::PropertyValue> aPropValue(5); aPropValue[0].Name = SC_UNONAME_STYLENAME; aPropValue[0].Value <<= OUString("Result2"); aPropValue[1].Name = SC_UNONAME_FORMULA1; @@ -108,7 +108,8 @@ uno::Reference< uno::XInterface > ScTableConditionalEntryObj::init() aPropValue[4].Value <<= table::CellAddress(0, 1, 5); xSheetConditionalEntries->addNew(aPropValue); - uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry(xSheetConditionalEntries->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSheetConditionalEntry( + xSheetConditionalEntries->getByIndex(0), uno::UNO_QUERY_THROW); return xSheetConditionalEntry; } diff --git a/sc/qa/extras/sctableconditionalformatobj.cxx b/sc/qa/extras/sctableconditionalformatobj.cxx index e8a66552516b..b1ba62f93c53 100644 --- a/sc/qa/extras/sctableconditionalformatobj.cxx +++ b/sc/qa/extras/sctableconditionalformatobj.cxx @@ -32,18 +32,17 @@ using namespace css; using namespace css::uno; using namespace com::sun::star; -namespace sc_apitest { - +namespace sc_apitest +{ #define NUMBER_OF_TESTS 3 -class ScTableConditionalFormatObj : public CalcUnoApiTest, - public apitest::XSheetConditionalEntries +class ScTableConditionalFormatObj : public CalcUnoApiTest, public apitest::XSheetConditionalEntries { public: ScTableConditionalFormatObj(); - virtual uno::Reference< uno::XInterface > init() override; - virtual uno::Sequence< beans::PropertyValue > createCondition(const sal_Int32 nr) override; + virtual uno::Reference<uno::XInterface> init() override; + virtual uno::Sequence<beans::PropertyValue> createCondition(const sal_Int32 nr) override; virtual void setUp() override; virtual void tearDown() override; @@ -58,37 +57,37 @@ public: private: static sal_Int32 nTest; - static uno::Reference< lang::XComponent > mxComponent; - + static uno::Reference<lang::XComponent> mxComponent; }; sal_Int32 ScTableConditionalFormatObj::nTest = 0; -uno::Reference< lang::XComponent > ScTableConditionalFormatObj::mxComponent; +uno::Reference<lang::XComponent> ScTableConditionalFormatObj::mxComponent; ScTableConditionalFormatObj::ScTableConditionalFormatObj() : CalcUnoApiTest("/sc/qa/extras/testdocuments") { } -uno::Reference< uno::XInterface > ScTableConditionalFormatObj::init() +uno::Reference<uno::XInterface> ScTableConditionalFormatObj::init() { // create a calc document if (!mxComponent.is()) mxComponent = loadFromDesktop("private:factory/scalc"); - uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); - uno::Reference< container::XIndexAccess > xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); xSheet->getCellByPosition(5, 5)->setValue(15); xSheet->getCellByPosition(1, 4)->setValue(10); xSheet->getCellByPosition(2, 0)->setValue(-5.15); - uno::Reference< beans::XPropertySet > xPropSet(xSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSheetConditionalEntries > xSheetConditionalEntries; - xSheetConditionalEntries.set(xPropSet->getPropertyValue(SC_UNONAME_CONDFMT), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropSet(xSheet, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntries> xSheetConditionalEntries; + xSheetConditionalEntries.set(xPropSet->getPropertyValue(SC_UNONAME_CONDFMT), + uno::UNO_QUERY_THROW); xSheetConditionalEntries->addNew(createCondition(5)); xSheetConditionalEntries->addNew(createCondition(2)); @@ -96,9 +95,9 @@ uno::Reference< uno::XInterface > ScTableConditionalFormatObj::init() return xSheetConditionalEntries; } -uno::Sequence< beans::PropertyValue > ScTableConditionalFormatObj::createCondition(const sal_Int32 nr) +uno::Sequence<beans::PropertyValue> ScTableConditionalFormatObj::createCondition(const sal_Int32 nr) { - uno::Sequence< beans::PropertyValue > aPropValue(5); + uno::Sequence<beans::PropertyValue> aPropValue(5); aPropValue[0].Name = SC_UNONAME_STYLENAME; aPropValue[0].Value <<= OUString("Result2"); aPropValue[1].Name = SC_UNONAME_FORMULA1; diff --git a/sc/qa/extras/sctablevalidationobj.cxx b/sc/qa/extras/sctablevalidationobj.cxx index 4b6b27622615..1fe21046071b 100644 --- a/sc/qa/extras/sctablevalidationobj.cxx +++ b/sc/qa/extras/sctablevalidationobj.cxx @@ -26,8 +26,8 @@ using namespace css; using namespace css::uno; using namespace com::sun::star; -namespace sc_apitest { - +namespace sc_apitest +{ #define NUMBER_OF_TESTS 4 class ScTableValidationObj : public CalcUnoApiTest, public apitest::XSheetCondition @@ -35,7 +35,7 @@ class ScTableValidationObj : public CalcUnoApiTest, public apitest::XSheetCondit public: ScTableValidationObj(); - virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference<uno::XInterface> init() override; virtual void setUp() override; virtual void tearDown() override; @@ -51,36 +51,35 @@ public: private: static sal_Int32 nTest; - static uno::Reference< lang::XComponent > mxComponent; - + static uno::Reference<lang::XComponent> mxComponent; }; sal_Int32 ScTableValidationObj::nTest = 0; -uno::Reference< lang::XComponent > ScTableValidationObj::mxComponent; +uno::Reference<lang::XComponent> ScTableValidationObj::mxComponent; ScTableValidationObj::ScTableValidationObj() : CalcUnoApiTest("/sc/qa/extras/testdocuments") { } -uno::Reference< uno::XInterface > ScTableValidationObj::init() +uno::Reference<uno::XInterface> ScTableValidationObj::init() { // create a calc document if (!mxComponent.is()) mxComponent = loadFromDesktop("private:factory/scalc"); - uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); - uno::Reference< container::XIndexAccess > xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); xSheet->getCellByPosition(5, 5)->setValue(15); xSheet->getCellByPosition(1, 4)->setValue(10); xSheet->getCellByPosition(2, 0)->setValue(-5.15); - uno::Reference< beans::XPropertySet > xPropSet(xSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSheetCondition > xSheetCondition; + uno::Reference<beans::XPropertySet> xPropSet(xSheet, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCondition> xSheetCondition; CPPUNIT_ASSERT(xPropSet->getPropertyValue("Validation") >>= xSheetCondition); return xSheetCondition; diff --git a/svx/source/dialog/ClassificationCommon.cxx b/svx/source/dialog/ClassificationCommon.cxx index 4d5d74938d5b..15734d7adc11 100644 --- a/svx/source/dialog/ClassificationCommon.cxx +++ b/svx/source/dialog/ClassificationCommon.cxx @@ -14,14 +14,15 @@ using namespace css; -namespace svx { -namespace classification { - -OUString convertClassificationResultToString(std::vector<svx::ClassificationResult> const & rResults) +namespace svx +{ +namespace classification +{ +OUString convertClassificationResultToString(std::vector<svx::ClassificationResult> const& rResults) { OUString sRepresentation = ""; - for (svx::ClassificationResult const & rResult : rResults) + for (svx::ClassificationResult const& rResult : rResults) { switch (rResult.meType) { @@ -30,17 +31,18 @@ OUString convertClassificationResultToString(std::vector<svx::ClassificationResu case svx::ClassificationType::MARKING: case svx::ClassificationType::TEXT: sRepresentation += rResult.msName; - break; + break; case svx::ClassificationType::PARAGRAPH: sRepresentation += " "; - break; + break; } } return sRepresentation; } -OUString getProperty(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer, OUString const & rName) +OUString getProperty(uno::Reference<beans::XPropertyContainer> const& rxPropertyContainer, + OUString const& rName) { try { @@ -54,18 +56,18 @@ OUString getProperty(uno::Reference<beans::XPropertyContainer> const & rxPropert return OUString(); } -bool containsProperty(uno::Sequence<beans::Property> const & rProperties, OUString const & rName) +bool containsProperty(uno::Sequence<beans::Property> const& rProperties, OUString const& rName) { - return std::find_if(rProperties.begin(), rProperties.end(), [&](const beans::Property& rProperty) - { - return rProperty.Name == rName; - }) != rProperties.end(); + return std::find_if(rProperties.begin(), rProperties.end(), + [&](const beans::Property& rProperty) { return rProperty.Name == rName; }) + != rProperties.end(); } -void removeAllProperties(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer) +void removeAllProperties(uno::Reference<beans::XPropertyContainer> const& rxPropertyContainer) { uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY); - uno::Sequence<beans::Property> aProperties = xPropertySet->getPropertySetInfo()->getProperties(); + uno::Sequence<beans::Property> aProperties + = xPropertySet->getPropertySetInfo()->getProperties(); for (const beans::Property& rProperty : aProperties) { @@ -73,7 +75,9 @@ void removeAllProperties(uno::Reference<beans::XPropertyContainer> const & rxPro } } -bool addOrInsertDocumentProperty(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer, OUString const & rsKey, OUString const & rsValue) +bool addOrInsertDocumentProperty( + uno::Reference<beans::XPropertyContainer> const& rxPropertyContainer, OUString const& rsKey, + OUString const& rsValue) { uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY); @@ -82,7 +86,8 @@ bool addOrInsertDocumentProperty(uno::Reference<beans::XPropertyContainer> const if (containsProperty(xPropertySet->getPropertySetInfo()->getProperties(), rsKey)) xPropertySet->setPropertyValue(rsKey, uno::makeAny(rsValue)); else - rxPropertyContainer->addProperty(rsKey, beans::PropertyAttribute::REMOVABLE, uno::makeAny(rsValue)); + rxPropertyContainer->addProperty(rsKey, beans::PropertyAttribute::REMOVABLE, + uno::makeAny(rsValue)); } catch (const uno::Exception& /*rException*/) { @@ -91,14 +96,16 @@ bool addOrInsertDocumentProperty(uno::Reference<beans::XPropertyContainer> const return true; } -void insertFullTextualRepresentationAsDocumentProperty(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer, - sfx::ClassificationKeyCreator const & rKeyCreator, - std::vector<svx::ClassificationResult> const & rResults) +void insertFullTextualRepresentationAsDocumentProperty( + uno::Reference<beans::XPropertyContainer> const& rxPropertyContainer, + sfx::ClassificationKeyCreator const& rKeyCreator, + std::vector<svx::ClassificationResult> const& rResults) { OUString sString = convertClassificationResultToString(rResults); - addOrInsertDocumentProperty(rxPropertyContainer, rKeyCreator.makeFullTextualRepresentationKey(), sString); + addOrInsertDocumentProperty(rxPropertyContainer, rKeyCreator.makeFullTextualRepresentationKey(), + sString); } - -}} // end svx::classification namespace +} +} // end svx::classification namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetcellrange.cxx b/test/source/sheet/xsheetcellrange.cxx index 46f0e64b0e8e..660bba5963a0 100644 --- a/test/source/sheet/xsheetcellrange.cxx +++ b/test/source/sheet/xsheetcellrange.cxx @@ -21,7 +21,6 @@ using namespace com::sun::star::uno; namespace apitest { - void XSheetCellRange::testGetSpreadsheet() { uno::Reference<sheet::XSheetCellRange> xSheetCellRange(init(), UNO_QUERY_THROW); diff --git a/test/source/sheet/xsheetcellrangecontainer.cxx b/test/source/sheet/xsheetcellrangecontainer.cxx index 05e630ab3f6e..be3c7453a2a0 100644 --- a/test/source/sheet/xsheetcellrangecontainer.cxx +++ b/test/source/sheet/xsheetcellrangecontainer.cxx @@ -22,7 +22,6 @@ using namespace com::sun::star::uno; namespace apitest { - void XSheetCellRangeContainer::testAddRemoveRangeAddress() { uno::Reference<sheet::XSheetCellRangeContainer> xSCRC(init(), UNO_QUERY_THROW); diff --git a/test/source/sheet/xsheetcellranges.cxx b/test/source/sheet/xsheetcellranges.cxx index 046541d02c23..cf785634b3a5 100644 --- a/test/source/sheet/xsheetcellranges.cxx +++ b/test/source/sheet/xsheetcellranges.cxx @@ -24,7 +24,6 @@ using namespace com::sun::star::uno; namespace apitest { - void XSheetCellRanges::testGetCells() { uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(init(), UNO_QUERY_THROW); diff --git a/test/source/sheet/xsheetcondition.cxx b/test/source/sheet/xsheetcondition.cxx index 402902700a79..a5bc07079b71 100644 --- a/test/source/sheet/xsheetcondition.cxx +++ b/test/source/sheet/xsheetcondition.cxx @@ -22,7 +22,6 @@ using namespace com::sun::star::uno; namespace apitest { - void XSheetCondition::testGetSetFormula1() { uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW); diff --git a/test/source/sheet/xsheetconditionalentries.cxx b/test/source/sheet/xsheetconditionalentries.cxx index b464303310cc..2d50310fec34 100644 --- a/test/source/sheet/xsheetconditionalentries.cxx +++ b/test/source/sheet/xsheetconditionalentries.cxx @@ -23,7 +23,6 @@ using namespace com::sun::star::uno; namespace apitest { - void XSheetConditionalEntries::testAddNew() { uno::Reference<sheet::XSheetConditionalEntries> xSheetConditionalEntries(init(), diff --git a/test/source/sheet/xsheetconditionalentry.cxx b/test/source/sheet/xsheetconditionalentry.cxx index e72c95a12129..d5a4e51af0f9 100644 --- a/test/source/sheet/xsheetconditionalentry.cxx +++ b/test/source/sheet/xsheetconditionalentry.cxx @@ -20,7 +20,6 @@ using namespace com::sun::star::uno; namespace apitest { - void XSheetConditionalEntry::testGetSetStyleName() { uno::Reference<sheet::XSheetConditionalEntry> xSheetConditionalEntry(init(), UNO_QUERY_THROW); diff --git a/tools/source/xml/XmlWalker.cxx b/tools/source/xml/XmlWalker.cxx index 9bec6d9dd534..61aedee7e6e4 100644 --- a/tools/source/xml/XmlWalker.cxx +++ b/tools/source/xml/XmlWalker.cxx @@ -15,17 +15,18 @@ #include <libxml/xmlstring.h> #include <vector> -namespace tools { - +namespace tools +{ struct XmlWalkerImpl { XmlWalkerImpl() : mpDocPtr(nullptr) , mpRoot(nullptr) , mpCurrent(nullptr) - {} + { + } - xmlDocPtr mpDocPtr; + xmlDocPtr mpDocPtr; xmlNodePtr mpRoot; xmlNodePtr mpCurrent; @@ -34,7 +35,8 @@ struct XmlWalkerImpl XmlWalker::XmlWalker() : mpImpl(o3tl::make_unique<XmlWalkerImpl>()) -{} +{ +} XmlWalker::~XmlWalker() { @@ -67,7 +69,8 @@ OString XmlWalker::content() OString aContent; if (mpImpl->mpCurrent->xmlChildrenNode != nullptr) { - xmlChar* pContent = xmlNodeListGetString(mpImpl->mpDocPtr, mpImpl->mpCurrent->xmlChildrenNode, 1); + xmlChar* pContent + = xmlNodeListGetString(mpImpl->mpDocPtr, mpImpl->mpCurrent->xmlChildrenNode, 1); aContent = OString(reinterpret_cast<const char*>(pContent)); xmlFree(pContent); } @@ -97,15 +100,9 @@ OString XmlWalker::attribute(OString sName) return aAttributeContent; } -void XmlWalker::next() -{ - mpImpl->mpCurrent = mpImpl->mpCurrent->next; -} +void XmlWalker::next() { mpImpl->mpCurrent = mpImpl->mpCurrent->next; } -bool XmlWalker::isValid() const -{ - return mpImpl->mpCurrent != nullptr; -} +bool XmlWalker::isValid() const { return mpImpl->mpCurrent != nullptr; } } // end tools namespace diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 014252bc39aa..5952dde13c96 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -12,10 +12,10 @@ #include <libxml/xmlwriter.h> -namespace tools { - -namespace { - +namespace tools +{ +namespace +{ int funcWriteCallback(void* pContext, const char* sBuffer, int nLen) { SvStream* pStream = static_cast<SvStream*>(pContext); @@ -36,7 +36,8 @@ struct XmlWriterImpl XmlWriterImpl(SvStream* pStream) : mpStream(pStream) , mpWriter(nullptr) - {} + { + } SvStream* mpStream; xmlTextWriterPtr mpWriter; @@ -44,18 +45,19 @@ struct XmlWriterImpl XmlWriter::XmlWriter(SvStream* pStream) : mpImpl(o3tl::make_unique<XmlWriterImpl>(pStream)) -{} +{ +} XmlWriter::~XmlWriter() { - if (mpImpl && mpImpl->mpWriter != nullptr) endDocument(); } bool XmlWriter::startDocument() { - xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(funcWriteCallback, funcCloseCallback, mpImpl->mpStream, nullptr); + xmlOutputBufferPtr xmlOutBuffer + = xmlOutputBufferCreateIO(funcWriteCallback, funcCloseCallback, mpImpl->mpStream, nullptr); mpImpl->mpWriter = xmlNewTextWriter(xmlOutBuffer); if (mpImpl->mpWriter == nullptr) return false; @@ -78,12 +80,9 @@ void XmlWriter::startElement(const OString& sName) xmlFree(xmlName); } -void XmlWriter::endElement() -{ - xmlTextWriterEndElement(mpImpl->mpWriter); -} +void XmlWriter::endElement() { xmlTextWriterEndElement(mpImpl->mpWriter); } -void XmlWriter::attribute(const OString& name, const OString & value) +void XmlWriter::attribute(const OString& name, const OString& value) { xmlChar* xmlName = xmlCharStrdup(name.getStr()); xmlChar* xmlValue = xmlCharStrdup(value.getStr()); diff --git a/vcl/inc/qt5/Qt5Font.hxx b/vcl/inc/qt5/Qt5Font.hxx index d8981578831a..789c925a104c 100644 --- a/vcl/inc/qt5/Qt5Font.hxx +++ b/vcl/inc/qt5/Qt5Font.hxx @@ -31,13 +31,16 @@ class VCL_DLLPUBLIC Qt5Font : public QFont hb_font_t* m_pHbFont; public: - Qt5Font( const FontSelectPattern& rFSP) - : m_aFontSelData( rFSP ), m_pHbFont( nullptr ) {} + Qt5Font(const FontSelectPattern& rFSP) + : m_aFontSelData(rFSP) + , m_pHbFont(nullptr) + { + } virtual ~Qt5Font(); - hb_font_t* GetHbFont() const { return m_pHbFont; } - void SetHbFont( hb_font_t* pHbFont ) { m_pHbFont = pHbFont; } - const FontSelectPattern& GetFontSelData() const { return m_aFontSelData; } + hb_font_t* GetHbFont() const { return m_pHbFont; } + void SetHbFont(hb_font_t* pHbFont) { m_pHbFont = pHbFont; } + const FontSelectPattern& GetFontSelData() const { return m_aFontSelData; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Bitmap.cxx b/vcl/qt5/Qt5Bitmap.cxx index 6fcff9e05663..0f312e0057e2 100644 --- a/vcl/qt5/Qt5Bitmap.cxx +++ b/vcl/qt5/Qt5Bitmap.cxx @@ -25,117 +25,96 @@ #include <QtCore/QVector> #include <QtGui/QColor> -Qt5Bitmap::Qt5Bitmap() -{ -} +Qt5Bitmap::Qt5Bitmap() {} -Qt5Bitmap::Qt5Bitmap( const QImage &rImage ) -{ - m_pImage.reset( new QImage( rImage ) ); -} +Qt5Bitmap::Qt5Bitmap(const QImage& rImage) { m_pImage.reset(new QImage(rImage)); } -Qt5Bitmap::~Qt5Bitmap() -{ -} +Qt5Bitmap::~Qt5Bitmap() {} -bool Qt5Bitmap::Create( const Size& rSize, sal_uInt16 nBitCount, - const BitmapPalette& rPal ) +bool Qt5Bitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal) { - assert( - (nBitCount == 1 - || nBitCount == 4 - || nBitCount == 8 - || nBitCount == 16 - || nBitCount == 24 - || nBitCount == 32) - && "Unsupported BitCount!"); + assert((nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24 + || nBitCount == 32) + && "Unsupported BitCount!"); - if ( nBitCount == 1 ) - assert( 2 == rPal.GetEntryCount() ); - if ( nBitCount == 4 ) - assert( 16 == rPal.GetEntryCount() ); - if ( nBitCount == 8 ) - assert( 256 == rPal.GetEntryCount() ); + if (nBitCount == 1) + assert(2 == rPal.GetEntryCount()); + if (nBitCount == 4) + assert(16 == rPal.GetEntryCount()); + if (nBitCount == 8) + assert(256 == rPal.GetEntryCount()); - if ( nBitCount == 4 ) + if (nBitCount == 4) { m_pImage.reset(); m_aSize = rSize; m_nScanline = rSize.Width() / 2 + (rSize.Width() % 2) ? 0 : 1; - m_pBuffer.reset( new sal_uInt8[ m_nScanline * rSize.Height() ] ); + m_pBuffer.reset(new sal_uInt8[m_nScanline * rSize.Height()]); } else { - m_pImage.reset( new QImage( toQSize( rSize ), getBitFormat( nBitCount ) ) ); + m_pImage.reset(new QImage(toQSize(rSize), getBitFormat(nBitCount))); m_pBuffer.reset(); } m_aPalette = rPal; auto count = rPal.GetEntryCount(); - if( nBitCount != 4 && count ) + if (nBitCount != 4 && count) { - QVector<QRgb> aColorTable( count ); - for ( unsigned i = 0; i < count; ++i ) - aColorTable[ i ] = qRgb( rPal[ i ].GetRed(), - rPal[ i ].GetGreen(), rPal[ i ].GetBlue() ); - m_pImage->setColorTable( aColorTable ); + QVector<QRgb> aColorTable(count); + for (unsigned i = 0; i < count; ++i) + aColorTable[i] = qRgb(rPal[i].GetRed(), rPal[i].GetGreen(), rPal[i].GetBlue()); + m_pImage->setColorTable(aColorTable); } return true; } -bool Qt5Bitmap::Create( const SalBitmap& rSalBmp ) +bool Qt5Bitmap::Create(const SalBitmap& rSalBmp) { - const Qt5Bitmap *pBitmap = static_cast< const Qt5Bitmap*>( &rSalBmp ); - if ( pBitmap->m_pImage.get() ) + const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp); + if (pBitmap->m_pImage.get()) { - m_pImage.reset( new QImage( *pBitmap->m_pImage.get() ) ); + m_pImage.reset(new QImage(*pBitmap->m_pImage.get())); m_pBuffer.reset(); } else { m_aSize = pBitmap->m_aSize; m_nScanline = pBitmap->m_nScanline; - m_pBuffer.reset( new sal_uInt8[ m_nScanline * m_aSize.Height() ] ); - memcpy( m_pBuffer.get(), pBitmap->m_pBuffer.get(), m_nScanline ); + m_pBuffer.reset(new sal_uInt8[m_nScanline * m_aSize.Height()]); + memcpy(m_pBuffer.get(), pBitmap->m_pBuffer.get(), m_nScanline); m_pImage.reset(); } m_aPalette = pBitmap->m_aPalette; return true; } -bool Qt5Bitmap::Create( const SalBitmap& rSalBmp, - SalGraphics* pSalGraphics ) +bool Qt5Bitmap::Create(const SalBitmap& rSalBmp, SalGraphics* pSalGraphics) { - const Qt5Bitmap *pBitmap = static_cast< const Qt5Bitmap *>( &rSalBmp ); - Qt5Graphics *pGraphics = static_cast< Qt5Graphics* >( pSalGraphics ); - QImage *pImage = pGraphics->m_pQImage; - m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( pImage->format() ) ) ); + const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp); + Qt5Graphics* pGraphics = static_cast<Qt5Graphics*>(pSalGraphics); + QImage* pImage = pGraphics->m_pQImage; + m_pImage.reset(new QImage(pBitmap->m_pImage->convertToFormat(pImage->format()))); m_pBuffer.reset(); return true; } -bool Qt5Bitmap::Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ) +bool Qt5Bitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount) { - assert( - (nNewBitCount == 1 - || nNewBitCount == 4 - || nNewBitCount == 8 - || nNewBitCount == 16 - || nNewBitCount == 24 - || nNewBitCount == 32) - && "Unsupported BitCount!"); + assert((nNewBitCount == 1 || nNewBitCount == 4 || nNewBitCount == 8 || nNewBitCount == 16 + || nNewBitCount == 24 || nNewBitCount == 32) + && "Unsupported BitCount!"); - const Qt5Bitmap *pBitmap = static_cast< const Qt5Bitmap *>( &rSalBmp ); - if ( pBitmap->m_pBuffer.get() ) + const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp); + if (pBitmap->m_pBuffer.get()) return false; - m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( getBitFormat( nNewBitCount ) ) ) ); + m_pImage.reset(new QImage(pBitmap->m_pImage->convertToFormat(getBitFormat(nNewBitCount)))); return true; } -bool Qt5Bitmap::Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, - Size& rSize, bool bMask ) +bool Qt5Bitmap::Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas, + Size& rSize, bool bMask) { return false; } @@ -148,32 +127,32 @@ void Qt5Bitmap::Destroy() Size Qt5Bitmap::GetSize() const { - if ( m_pBuffer.get() ) + if (m_pBuffer.get()) return m_aSize; - else if ( m_pImage.get() ) - return toSize( m_pImage->size() ); + else if (m_pImage.get()) + return toSize(m_pImage->size()); return Size(); } sal_uInt16 Qt5Bitmap::GetBitCount() const { - if ( m_pBuffer.get() ) + if (m_pBuffer.get()) return 4; - else if ( m_pImage.get() ) - return getFormatBits( m_pImage->format() ); + else if (m_pImage.get()) + return getFormatBits(m_pImage->format()); return 0; } -BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode ) +BitmapBuffer* Qt5Bitmap::AcquireBuffer(BitmapAccessMode nMode) { static const BitmapPalette aEmptyPalette; - if ( !(m_pImage.get() || m_pBuffer.get()) ) + if (!(m_pImage.get() || m_pBuffer.get())) return nullptr; BitmapBuffer* pBuffer = new BitmapBuffer; - if ( m_pBuffer.get() ) + if (m_pBuffer.get()) { pBuffer->mnWidth = m_aSize.Width(); pBuffer->mnHeight = m_aSize.Height(); @@ -185,12 +164,12 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode ) { pBuffer->mnWidth = m_pImage->width(); pBuffer->mnHeight = m_pImage->height(); - pBuffer->mnBitCount = getFormatBits( m_pImage->format() ); + pBuffer->mnBitCount = getFormatBits(m_pImage->format()); pBuffer->mpBits = m_pImage->bits(); pBuffer->mnScanlineSize = m_pImage->bytesPerLine(); } - switch( pBuffer->mnBitCount ) + switch (pBuffer->mnBitCount) { case 1: pBuffer->mnFormat = ScanlineFormat::N1BitLsbPal | ScanlineFormat::TopDown; @@ -207,9 +186,9 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode ) case 16: { #ifdef OSL_BIGENDIAN - pBuffer->mnFormat= ScanlineFormat::N16BitTcMsbMask | ScanlineFormat::TopDown; + pBuffer->mnFormat = ScanlineFormat::N16BitTcMsbMask | ScanlineFormat::TopDown; #else - pBuffer->mnFormat= ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::TopDown; + pBuffer->mnFormat = ScanlineFormat::N16BitTcLsbMask | ScanlineFormat::TopDown; #endif ColorMaskElement aRedMask(0xf800); // 5 aRedMask.CalcMaskShift(); @@ -236,37 +215,31 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer( BitmapAccessMode nMode ) return pBuffer; } -void Qt5Bitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) +void Qt5Bitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode) { m_aPalette = pBuffer->maPalette; auto count = m_aPalette.GetEntryCount(); - if( pBuffer->mnBitCount != 4 && count ) + if (pBuffer->mnBitCount != 4 && count) { - QVector<QRgb> aColorTable( count ); - for ( unsigned i = 0; i < count; ++i ) - aColorTable[ i ] = qRgb( m_aPalette[ i ].GetRed(), - m_aPalette[ i ].GetGreen(), m_aPalette[ i ].GetBlue() ); - m_pImage->setColorTable( aColorTable ); + QVector<QRgb> aColorTable(count); + for (unsigned i = 0; i < count; ++i) + aColorTable[i] + = qRgb(m_aPalette[i].GetRed(), m_aPalette[i].GetGreen(), m_aPalette[i].GetBlue()); + m_pImage->setColorTable(aColorTable); } delete pBuffer; } -bool Qt5Bitmap::GetSystemData( BitmapSystemData& rData ) -{ - return false; -} +bool Qt5Bitmap::GetSystemData(BitmapSystemData& rData) { return false; } -bool Qt5Bitmap::ScalingSupported() const -{ - return false; -} +bool Qt5Bitmap::ScalingSupported() const { return false; } -bool Qt5Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) +bool Qt5Bitmap::Scale(const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag) { return false; } -bool Qt5Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) +bool Qt5Bitmap::Replace(const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol) { return false; } diff --git a/vcl/qt5/Qt5Bitmap.hxx b/vcl/qt5/Qt5Bitmap.hxx index 99c9641db789..c8d35e2050cc 100644 --- a/vcl/qt5/Qt5Bitmap.hxx +++ b/vcl/qt5/Qt5Bitmap.hxx @@ -27,43 +27,41 @@ class QImage; class VCL_DLLPUBLIC Qt5Bitmap : public SalBitmap { - std::unique_ptr< QImage > m_pImage; - BitmapPalette m_aPalette; + std::unique_ptr<QImage> m_pImage; + BitmapPalette m_aPalette; // for 4bit support - std::unique_ptr< sal_uInt8 > m_pBuffer; - Size m_aSize; - sal_uInt32 m_nScanline; + std::unique_ptr<sal_uInt8> m_pBuffer; + Size m_aSize; + sal_uInt32 m_nScanline; public: Qt5Bitmap(); - Qt5Bitmap( const QImage& rQImage ); + Qt5Bitmap(const QImage& rQImage); virtual ~Qt5Bitmap() override; - const QImage* GetQImage() const { return m_pImage.get(); } + const QImage* GetQImage() const { return m_pImage.get(); } - virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ) override; - virtual bool Create( const SalBitmap& rSalBmp ) override; - virtual bool Create( const SalBitmap& rSalBmp, - SalGraphics* pGraphics ) override; - virtual bool Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ) override; - virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, - Size& rSize, - bool bMask = false ) override; - virtual void Destroy() final override; - virtual Size GetSize() const override; - virtual sal_uInt16 GetBitCount() const override; + virtual bool Create(const Size& rSize, sal_uInt16 nBitCount, + const BitmapPalette& rPal) override; + virtual bool Create(const SalBitmap& rSalBmp) override; + virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) override; + virtual bool Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount) override; + virtual bool Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas, + Size& rSize, bool bMask = false) override; + virtual void Destroy() final override; + virtual Size GetSize() const override; + virtual sal_uInt16 GetBitCount() const override; - virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override; - virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override; - virtual bool GetSystemData( BitmapSystemData& rData ) override; + virtual BitmapBuffer* AcquireBuffer(BitmapAccessMode nMode) override; + virtual void ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode) override; + virtual bool GetSystemData(BitmapSystemData& rData) override; - virtual bool ScalingSupported() const override; - virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override; - virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) override; + virtual bool ScalingSupported() const override; + virtual bool Scale(const double& rScaleX, const double& rScaleY, + BmpScaleFlag nScaleFlag) override; + virtual bool Replace(const Color& rSearchColor, const Color& rReplaceColor, + sal_uLong nTol) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx index 3d524bd11c71..7fdae2cc0a9c 100644 --- a/vcl/qt5/Qt5Data.cxx +++ b/vcl/qt5/Qt5Data.cxx @@ -24,13 +24,13 @@ #include <unx/x11_cursors/salcursors.h> -Qt5Data::Qt5Data( SalInstance *pInstance ) - : GenericUnixSalData( SAL_DATA_QT5, pInstance ) +Qt5Data::Qt5Data(SalInstance* pInstance) + : GenericUnixSalData(SAL_DATA_QT5, pInstance) { - for (QCursor* & rpCsr : m_aCursors) + for (QCursor*& rpCsr : m_aCursors) rpCsr = nullptr; - ImplSVData *pSVData = ImplGetSVData(); + ImplSVData* pSVData = ImplGetSVData(); // draw toolbars on separate lines pSVData->maNWFData.mbDockingAreaSeparateTB = true; @@ -38,169 +38,160 @@ Qt5Data::Qt5Data( SalInstance *pInstance ) Qt5Data::~Qt5Data() { - for (QCursor* & rpCsr : m_aCursors) + for (QCursor*& rpCsr : m_aCursors) delete rpCsr; } -static QCursor* getQCursorFromXBM( const unsigned char *pBitmap, - const unsigned char *pMask, - int nWidth, int nHeight, - int nXHot, int nYHot ) +static QCursor* getQCursorFromXBM(const unsigned char* pBitmap, const unsigned char* pMask, + int nWidth, int nHeight, int nXHot, int nYHot) { QBitmap aPixmap; - aPixmap.loadFromData( pBitmap, nWidth * nHeight / 8, "XPM" ); + aPixmap.loadFromData(pBitmap, nWidth * nHeight / 8, "XPM"); QBitmap aMask; - aMask.loadFromData( pMask, nWidth * nHeight / 8, "XPM" ); - aPixmap.setMask( aMask ); - return new QCursor( aPixmap, nXHot, nYHot ); + aMask.loadFromData(pMask, nWidth * nHeight / 8, "XPM"); + aPixmap.setMask(aMask); + return new QCursor(aPixmap, nXHot, nYHot); } -#define MAKE_CURSOR( vcl_name, name ) \ - case vcl_name: \ - pCursor = getQCursorFromXBM( name##curs##_bits, name##mask##_bits, \ - name##curs_width, name##curs_height, \ - name##curs_x_hot, name##curs_y_hot ); \ +#define MAKE_CURSOR(vcl_name, name) \ + case vcl_name: \ + pCursor = getQCursorFromXBM(name##curs##_bits, name##mask##_bits, name##curs_width, \ + name##curs_height, name##curs_x_hot, name##curs_y_hot); \ break -#define MAP_BUILTIN( vcl_name, qt_enum ) \ - case vcl_name: \ - pCursor = new QCursor( qt_enum ); \ +#define MAP_BUILTIN(vcl_name, qt_enum) \ + case vcl_name: \ + pCursor = new QCursor(qt_enum); \ break -QCursor& Qt5Data::getCursor( PointerStyle ePointerStyle ) +QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle) { - if ( !m_aCursors[ ePointerStyle ] ) + if (!m_aCursors[ePointerStyle]) { - QCursor *pCursor = nullptr; + QCursor* pCursor = nullptr; - switch( ePointerStyle ) + switch (ePointerStyle) { - MAP_BUILTIN( PointerStyle::Arrow, Qt::ArrowCursor ); - MAP_BUILTIN( PointerStyle::Text, Qt::IBeamCursor ); - MAP_BUILTIN( PointerStyle::Help, Qt::WhatsThisCursor ); - MAP_BUILTIN( PointerStyle::Cross, Qt::CrossCursor ); - MAP_BUILTIN( PointerStyle::Wait, Qt::WaitCursor ); - MAP_BUILTIN( PointerStyle::NSize, Qt::SizeVerCursor ); - MAP_BUILTIN( PointerStyle::SSize, Qt::SizeVerCursor ); - MAP_BUILTIN( PointerStyle::WSize, Qt::SizeHorCursor ); - MAP_BUILTIN( PointerStyle::ESize, Qt::SizeHorCursor ); - - MAP_BUILTIN( PointerStyle::NWSize, Qt::SizeFDiagCursor ); - MAP_BUILTIN( PointerStyle::NESize, Qt::SizeBDiagCursor ); - MAP_BUILTIN( PointerStyle::SWSize, Qt::SizeBDiagCursor ); - MAP_BUILTIN( PointerStyle::SESize, Qt::SizeFDiagCursor ); + MAP_BUILTIN(PointerStyle::Arrow, Qt::ArrowCursor); + MAP_BUILTIN(PointerStyle::Text, Qt::IBeamCursor); + MAP_BUILTIN(PointerStyle::Help, Qt::WhatsThisCursor); + MAP_BUILTIN(PointerStyle::Cross, Qt::CrossCursor); + MAP_BUILTIN(PointerStyle::Wait, Qt::WaitCursor); + MAP_BUILTIN(PointerStyle::NSize, Qt::SizeVerCursor); + MAP_BUILTIN(PointerStyle::SSize, Qt::SizeVerCursor); + MAP_BUILTIN(PointerStyle::WSize, Qt::SizeHorCursor); + MAP_BUILTIN(PointerStyle::ESize, Qt::SizeHorCursor); + + MAP_BUILTIN(PointerStyle::NWSize, Qt::SizeFDiagCursor); + MAP_BUILTIN(PointerStyle::NESize, Qt::SizeBDiagCursor); + MAP_BUILTIN(PointerStyle::SWSize, Qt::SizeBDiagCursor); + MAP_BUILTIN(PointerStyle::SESize, Qt::SizeFDiagCursor); #if 0 MAP_BUILTIN( PointerStyle::WindowNSize, GDK_TOP_SIDE ); MAP_BUILTIN( PointerStyle::WindowSSize, GDK_BOTTOM_SIDE ); MAP_BUILTIN( PointerStyle::WindowWSize, GDK_LEFT_SIDE ); MAP_BUILTIN( PointerStyle::WindowESize, GDK_RIGHT_SIDE ); #endif - MAP_BUILTIN( PointerStyle::WindowNWSize, Qt::SizeFDiagCursor ); - MAP_BUILTIN( PointerStyle::WindowNESize, Qt::SizeBDiagCursor ); - MAP_BUILTIN( PointerStyle::WindowSWSize, Qt::SizeBDiagCursor ); - MAP_BUILTIN( PointerStyle::WindowSESize, Qt::SizeFDiagCursor ); + MAP_BUILTIN(PointerStyle::WindowNWSize, Qt::SizeFDiagCursor); + MAP_BUILTIN(PointerStyle::WindowNESize, Qt::SizeBDiagCursor); + MAP_BUILTIN(PointerStyle::WindowSWSize, Qt::SizeBDiagCursor); + MAP_BUILTIN(PointerStyle::WindowSESize, Qt::SizeFDiagCursor); - MAP_BUILTIN( PointerStyle::HSizeBar, Qt::SizeHorCursor ); - MAP_BUILTIN( PointerStyle::VSizeBar, Qt::SizeVerCursor ); + MAP_BUILTIN(PointerStyle::HSizeBar, Qt::SizeHorCursor); + MAP_BUILTIN(PointerStyle::VSizeBar, Qt::SizeVerCursor); - MAP_BUILTIN( PointerStyle::RefHand, Qt::OpenHandCursor ); - MAP_BUILTIN( PointerStyle::Hand, Qt::OpenHandCursor ); + MAP_BUILTIN(PointerStyle::RefHand, Qt::OpenHandCursor); + MAP_BUILTIN(PointerStyle::Hand, Qt::OpenHandCursor); #if 0 MAP_BUILTIN( PointerStyle::Pen, GDK_PENCIL ); #endif - MAP_BUILTIN( PointerStyle::HSplit, Qt::SizeHorCursor ); - MAP_BUILTIN( PointerStyle::VSplit, Qt::SizeVerCursor ); - - MAP_BUILTIN( PointerStyle::Move, Qt::SizeAllCursor ); - - MAP_BUILTIN( PointerStyle::Null, Qt::BlankCursor ); - MAKE_CURSOR( PointerStyle::Magnify, magnify_ ); - MAKE_CURSOR( PointerStyle::Fill, fill_ ); - MAKE_CURSOR( PointerStyle::MoveData, movedata_ ); - MAKE_CURSOR( PointerStyle::CopyData, copydata_ ); - MAKE_CURSOR( PointerStyle::MoveFile, movefile_ ); - MAKE_CURSOR( PointerStyle::CopyFile, copyfile_ ); - MAKE_CURSOR( PointerStyle::MoveFiles, movefiles_ ); - MAKE_CURSOR( PointerStyle::CopyFiles, copyfiles_ ); - MAKE_CURSOR( PointerStyle::NotAllowed, nodrop_ ); - MAKE_CURSOR( PointerStyle::Rotate, rotate_ ); - MAKE_CURSOR( PointerStyle::HShear, hshear_ ); - MAKE_CURSOR( PointerStyle::VShear, vshear_ ); - MAKE_CURSOR( PointerStyle::DrawLine, drawline_ ); - MAKE_CURSOR( PointerStyle::DrawRect, drawrect_ ); - MAKE_CURSOR( PointerStyle::DrawPolygon, drawpolygon_ ); - MAKE_CURSOR( PointerStyle::DrawBezier, drawbezier_ ); - MAKE_CURSOR( PointerStyle::DrawArc, drawarc_ ); - MAKE_CURSOR( PointerStyle::DrawPie, drawpie_ ); - MAKE_CURSOR( PointerStyle::DrawCircleCut, drawcirclecut_ ); - MAKE_CURSOR( PointerStyle::DrawEllipse, drawellipse_ ); - MAKE_CURSOR( PointerStyle::DrawConnect, drawconnect_ ); - MAKE_CURSOR( PointerStyle::DrawText, drawtext_ ); - MAKE_CURSOR( PointerStyle::Mirror, mirror_ ); - MAKE_CURSOR( PointerStyle::Crook, crook_ ); - MAKE_CURSOR( PointerStyle::Crop, crop_ ); - MAKE_CURSOR( PointerStyle::MovePoint, movepoint_ ); - MAKE_CURSOR( PointerStyle::MoveBezierWeight, movebezierweight_ ); - MAKE_CURSOR( PointerStyle::DrawFreehand, drawfreehand_ ); - MAKE_CURSOR( PointerStyle::DrawCaption, drawcaption_ ); - MAKE_CURSOR( PointerStyle::LinkData, linkdata_ ); - MAKE_CURSOR( PointerStyle::MoveDataLink, movedlnk_ ); - MAKE_CURSOR( PointerStyle::CopyDataLink, copydlnk_ ); - MAKE_CURSOR( PointerStyle::LinkFile, linkfile_ ); - MAKE_CURSOR( PointerStyle::MoveFileLink, moveflnk_ ); - MAKE_CURSOR( PointerStyle::CopyFileLink, copyflnk_ ); - MAKE_CURSOR( PointerStyle::Chart, chart_ ); - MAKE_CURSOR( PointerStyle::Detective, detective_ ); - MAKE_CURSOR( PointerStyle::PivotCol, pivotcol_ ); - MAKE_CURSOR( PointerStyle::PivotRow, pivotrow_ ); - MAKE_CURSOR( PointerStyle::PivotField, pivotfld_ ); - MAKE_CURSOR( PointerStyle::PivotDelete, pivotdel_ ); - MAKE_CURSOR( PointerStyle::Chain, chain_ ); - MAKE_CURSOR( PointerStyle::ChainNotAllowed, chainnot_ ); - MAKE_CURSOR( PointerStyle::AutoScrollN, asn_ ); - MAKE_CURSOR( PointerStyle::AutoScrollS, ass_ ); - MAKE_CURSOR( PointerStyle::AutoScrollW, asw_ ); - MAKE_CURSOR( PointerStyle::AutoScrollE, ase_ ); - MAKE_CURSOR( PointerStyle::AutoScrollNW, asnw_ ); - MAKE_CURSOR( PointerStyle::AutoScrollNE, asne_ ); - MAKE_CURSOR( PointerStyle::AutoScrollSW, assw_ ); - MAKE_CURSOR( PointerStyle::AutoScrollSE, asse_ ); - MAKE_CURSOR( PointerStyle::AutoScrollNS, asns_ ); - MAKE_CURSOR( PointerStyle::AutoScrollWE, aswe_ ); - MAKE_CURSOR( PointerStyle::AutoScrollNSWE, asnswe_ ); - MAKE_CURSOR( PointerStyle::TextVertical, vertcurs_ ); - - MAKE_CURSOR( PointerStyle::TabSelectS, tblsels_ ); - MAKE_CURSOR( PointerStyle::TabSelectE, tblsele_ ); - MAKE_CURSOR( PointerStyle::TabSelectSE, tblselse_ ); - MAKE_CURSOR( PointerStyle::TabSelectW, tblselw_ ); - MAKE_CURSOR( PointerStyle::TabSelectSW, tblselsw_ ); - - MAKE_CURSOR( PointerStyle::HideWhitespace, hidewhitespace_ ); - MAKE_CURSOR( PointerStyle::ShowWhitespace, showwhitespace_ ); - default: - break; + MAP_BUILTIN(PointerStyle::HSplit, Qt::SizeHorCursor); + MAP_BUILTIN(PointerStyle::VSplit, Qt::SizeVerCursor); + + MAP_BUILTIN(PointerStyle::Move, Qt::SizeAllCursor); + + MAP_BUILTIN(PointerStyle::Null, Qt::BlankCursor); + MAKE_CURSOR(PointerStyle::Magnify, magnify_); + MAKE_CURSOR(PointerStyle::Fill, fill_); + MAKE_CURSOR(PointerStyle::MoveData, movedata_); + MAKE_CURSOR(PointerStyle::CopyData, copydata_); + MAKE_CURSOR(PointerStyle::MoveFile, movefile_); + MAKE_CURSOR(PointerStyle::CopyFile, copyfile_); + MAKE_CURSOR(PointerStyle::MoveFiles, movefiles_); + MAKE_CURSOR(PointerStyle::CopyFiles, copyfiles_); + MAKE_CURSOR(PointerStyle::NotAllowed, nodrop_); + MAKE_CURSOR(PointerStyle::Rotate, rotate_); + MAKE_CURSOR(PointerStyle::HShear, hshear_); + MAKE_CURSOR(PointerStyle::VShear, vshear_); + MAKE_CURSOR(PointerStyle::DrawLine, drawline_); + MAKE_CURSOR(PointerStyle::DrawRect, drawrect_); + MAKE_CURSOR(PointerStyle::DrawPolygon, drawpolygon_); + MAKE_CURSOR(PointerStyle::DrawBezier, drawbezier_); + MAKE_CURSOR(PointerStyle::DrawArc, drawarc_); + MAKE_CURSOR(PointerStyle::DrawPie, drawpie_); + MAKE_CURSOR(PointerStyle::DrawCircleCut, drawcirclecut_); + MAKE_CURSOR(PointerStyle::DrawEllipse, drawellipse_); + MAKE_CURSOR(PointerStyle::DrawConnect, drawconnect_); + MAKE_CURSOR(PointerStyle::DrawText, drawtext_); + MAKE_CURSOR(PointerStyle::Mirror, mirror_); + MAKE_CURSOR(PointerStyle::Crook, crook_); + MAKE_CURSOR(PointerStyle::Crop, crop_); + MAKE_CURSOR(PointerStyle::MovePoint, movepoint_); + MAKE_CURSOR(PointerStyle::MoveBezierWeight, movebezierweight_); + MAKE_CURSOR(PointerStyle::DrawFreehand, drawfreehand_); + MAKE_CURSOR(PointerStyle::DrawCaption, drawcaption_); + MAKE_CURSOR(PointerStyle::LinkData, linkdata_); + MAKE_CURSOR(PointerStyle::MoveDataLink, movedlnk_); + MAKE_CURSOR(PointerStyle::CopyDataLink, copydlnk_); + MAKE_CURSOR(PointerStyle::LinkFile, linkfile_); + MAKE_CURSOR(PointerStyle::MoveFileLink, moveflnk_); + MAKE_CURSOR(PointerStyle::CopyFileLink, copyflnk_); + MAKE_CURSOR(PointerStyle::Chart, chart_); + MAKE_CURSOR(PointerStyle::Detective, detective_); + MAKE_CURSOR(PointerStyle::PivotCol, pivotcol_); + MAKE_CURSOR(PointerStyle::PivotRow, pivotrow_); + MAKE_CURSOR(PointerStyle::PivotField, pivotfld_); + MAKE_CURSOR(PointerStyle::PivotDelete, pivotdel_); + MAKE_CURSOR(PointerStyle::Chain, chain_); + MAKE_CURSOR(PointerStyle::ChainNotAllowed, chainnot_); + MAKE_CURSOR(PointerStyle::AutoScrollN, asn_); + MAKE_CURSOR(PointerStyle::AutoScrollS, ass_); + MAKE_CURSOR(PointerStyle::AutoScrollW, asw_); + MAKE_CURSOR(PointerStyle::AutoScrollE, ase_); + MAKE_CURSOR(PointerStyle::AutoScrollNW, asnw_); + MAKE_CURSOR(PointerStyle::AutoScrollNE, asne_); + MAKE_CURSOR(PointerStyle::AutoScrollSW, assw_); + MAKE_CURSOR(PointerStyle::AutoScrollSE, asse_); + MAKE_CURSOR(PointerStyle::AutoScrollNS, asns_); + MAKE_CURSOR(PointerStyle::AutoScrollWE, aswe_); + MAKE_CURSOR(PointerStyle::AutoScrollNSWE, asnswe_); + MAKE_CURSOR(PointerStyle::TextVertical, vertcurs_); + + MAKE_CURSOR(PointerStyle::TabSelectS, tblsels_); + MAKE_CURSOR(PointerStyle::TabSelectE, tblsele_); + MAKE_CURSOR(PointerStyle::TabSelectSE, tblselse_); + MAKE_CURSOR(PointerStyle::TabSelectW, tblselw_); + MAKE_CURSOR(PointerStyle::TabSelectSW, tblselsw_); + + MAKE_CURSOR(PointerStyle::HideWhitespace, hidewhitespace_); + MAKE_CURSOR(PointerStyle::ShowWhitespace, showwhitespace_); + default: + break; } - if( !pCursor ) + if (!pCursor) { - pCursor = new QCursor( Qt::ArrowCursor ); - SAL_WARN( "vcl.qt5", "pointer " << static_cast<int>(ePointerStyle) << "not implemented" ); + pCursor = new QCursor(Qt::ArrowCursor); + SAL_WARN("vcl.qt5", "pointer " << static_cast<int>(ePointerStyle) << "not implemented"); } - m_aCursors[ ePointerStyle ] = pCursor; + m_aCursors[ePointerStyle] = pCursor; } - return *m_aCursors[ ePointerStyle ]; + return *m_aCursors[ePointerStyle]; } +void Qt5Data::ErrorTrapPush() {} -void Qt5Data::ErrorTrapPush() -{ -} - -bool Qt5Data::ErrorTrapPop( bool bIgnoreError ) -{ - return false; -} +bool Qt5Data::ErrorTrapPop(bool bIgnoreError) { return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Data.hxx b/vcl/qt5/Qt5Data.hxx index 75e1a813e1f9..a63d243b6967 100644 --- a/vcl/qt5/Qt5Data.hxx +++ b/vcl/qt5/Qt5Data.hxx @@ -31,13 +31,13 @@ class Qt5Data : public GenericUnixSalData o3tl::enumarray<PointerStyle, QCursor*> m_aCursors; public: - explicit Qt5Data( SalInstance *pInstance ); + explicit Qt5Data(SalInstance* pInstance); virtual ~Qt5Data() override; virtual void ErrorTrapPush() override; - virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; + virtual bool ErrorTrapPop(bool bIgnoreError = true) override; - QCursor& getCursor( PointerStyle ePointerStyle ); + QCursor& getCursor(PointerStyle ePointerStyle); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Font.cxx b/vcl/qt5/Qt5Font.cxx index 8ad5e2b0c040..01a45d359600 100644 --- a/vcl/qt5/Qt5Font.cxx +++ b/vcl/qt5/Qt5Font.cxx @@ -19,8 +19,6 @@ #include <qt5/Qt5Font.hxx> -Qt5Font::~Qt5Font() -{ -} +Qt5Font::~Qt5Font() {} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx index 347f6bb58ba5..6d7074bbbb51 100644 --- a/vcl/qt5/Qt5FontFace.cxx +++ b/vcl/qt5/Qt5FontFace.cxx @@ -31,67 +31,62 @@ using namespace vcl; -Qt5FontFace::Qt5FontFace( const Qt5FontFace& rSrc ) - : PhysicalFontFace( rSrc ) - , m_aFontId( rSrc.m_aFontId ) +Qt5FontFace::Qt5FontFace(const Qt5FontFace& rSrc) + : PhysicalFontFace(rSrc) + , m_aFontId(rSrc.m_aFontId) { - if( rSrc.m_xCharMap.is() ) + if (rSrc.m_xCharMap.is()) m_xCharMap = rSrc.m_xCharMap; } -Qt5FontFace* Qt5FontFace::fromQFont( const QFont &rFont ) +Qt5FontFace* Qt5FontFace::fromQFont(const QFont& rFont) { FontAttributes aFA; - aFA.SetFamilyName( toOUString( rFont.family() ) ); - aFA.SetStyleName( toOUString( rFont.styleName() ) ); - aFA.SetItalic( rFont.italic() ? ITALIC_NORMAL : ITALIC_NONE ); + aFA.SetFamilyName(toOUString(rFont.family())); + aFA.SetStyleName(toOUString(rFont.styleName())); + aFA.SetItalic(rFont.italic() ? ITALIC_NORMAL : ITALIC_NONE); - return new Qt5FontFace( aFA, rFont.toString() ) ; + return new Qt5FontFace(aFA, rFont.toString()); } -Qt5FontFace::Qt5FontFace( const FontAttributes& rFA, const QString &rFontID ) - : PhysicalFontFace( rFA ) - , m_aFontId( rFontID ) - , m_bFontCapabilitiesRead( false ) +Qt5FontFace::Qt5FontFace(const FontAttributes& rFA, const QString& rFontID) + : PhysicalFontFace(rFA) + , m_aFontId(rFontID) + , m_bFontCapabilitiesRead(false) { } -Qt5FontFace::~Qt5FontFace() -{ -} +Qt5FontFace::~Qt5FontFace() {} -sal_IntPtr Qt5FontFace::GetFontId() const -{ - return reinterpret_cast<sal_IntPtr>( &m_aFontId ); -} +sal_IntPtr Qt5FontFace::GetFontId() const { return reinterpret_cast<sal_IntPtr>(&m_aFontId); } const FontCharMapRef Qt5FontFace::GetFontCharMap() const { - if( m_xCharMap.is() ) + if (m_xCharMap.is()) return m_xCharMap; QFont aFont; - aFont.fromString( m_aFontId ); - QRawFont aRawFont( QRawFont::fromFont( aFont ) ); - QByteArray aCMapTable = aRawFont.fontTable( "cmap" ); - if ( aCMapTable.isEmpty() ) + aFont.fromString(m_aFontId); + QRawFont aRawFont(QRawFont::fromFont(aFont)); + QByteArray aCMapTable = aRawFont.fontTable("cmap"); + if (aCMapTable.isEmpty()) { m_xCharMap = new FontCharMap(); return m_xCharMap; } CmapResult aCmapResult; - if( ParseCMAP( reinterpret_cast<const unsigned char*>( aCMapTable.data() ), - aCMapTable.size(), aCmapResult ) ) - m_xCharMap = new FontCharMap( aCmapResult ); + if (ParseCMAP(reinterpret_cast<const unsigned char*>(aCMapTable.data()), aCMapTable.size(), + aCmapResult)) + m_xCharMap = new FontCharMap(aCmapResult); return m_xCharMap; } -bool Qt5FontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +bool Qt5FontFace::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const { // read this only once per font - if( m_bFontCapabilitiesRead ) + if (m_bFontCapabilitiesRead) { rFontCapabilities = m_aFontCapabilities; return rFontCapabilities.oUnicodeRange || rFontCapabilities.oCodePageRange; @@ -99,28 +94,23 @@ bool Qt5FontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) m_bFontCapabilitiesRead = true; QFont aFont; - aFont.fromString( m_aFontId ); - QRawFont aRawFont( QRawFont::fromFont( aFont ) ); - QByteArray aOS2Table = aRawFont.fontTable( "OS/2" ); - if ( !aOS2Table.isEmpty() ) + aFont.fromString(m_aFontId); + QRawFont aRawFont(QRawFont::fromFont(aFont)); + QByteArray aOS2Table = aRawFont.fontTable("OS/2"); + if (!aOS2Table.isEmpty()) { - vcl::getTTCoverage( m_aFontCapabilities.oUnicodeRange, - m_aFontCapabilities.oCodePageRange, - reinterpret_cast<const unsigned char*>( aOS2Table.data() ), - aOS2Table.size() ); + vcl::getTTCoverage(m_aFontCapabilities.oUnicodeRange, m_aFontCapabilities.oCodePageRange, + reinterpret_cast<const unsigned char*>(aOS2Table.data()), + aOS2Table.size()); } rFontCapabilities = m_aFontCapabilities; return rFontCapabilities.oUnicodeRange || rFontCapabilities.oCodePageRange; } -PhysicalFontFace* Qt5FontFace::Clone() const -{ - return new Qt5FontFace( *this ); -} +PhysicalFontFace* Qt5FontFace::Clone() const { return new Qt5FontFace(*this); } -LogicalFontInstance* Qt5FontFace::CreateFontInstance( const FontSelectPattern& rFSD ) const +LogicalFontInstance* Qt5FontFace::CreateFontInstance(const FontSelectPattern& rFSD) const { - return new LogicalFontInstance( rFSD ); + return new LogicalFontInstance(rFSD); } - diff --git a/vcl/qt5/Qt5FontFace.hxx b/vcl/qt5/Qt5FontFace.hxx index 7cfbdf8be702..259b95939556 100644 --- a/vcl/qt5/Qt5FontFace.hxx +++ b/vcl/qt5/Qt5FontFace.hxx @@ -34,29 +34,29 @@ class QFont; class Qt5FontFace : public PhysicalFontFace { public: - virtual ~Qt5FontFace() override; + virtual ~Qt5FontFace() override; - static Qt5FontFace* fromQFont( const QFont &rFont ); + static Qt5FontFace* fromQFont(const QFont& rFont); - PhysicalFontFace* Clone() const override; - LogicalFontInstance* CreateFontInstance( const FontSelectPattern& ) const override; - sal_IntPtr GetFontId() const override; + PhysicalFontFace* Clone() const override; + LogicalFontInstance* CreateFontInstance(const FontSelectPattern&) const override; + sal_IntPtr GetFontId() const override; - int GetFontTable( const char pTagName[5], unsigned char* ) const; + int GetFontTable(const char pTagName[5], unsigned char*) const; - const FontCharMapRef GetFontCharMap() const; - bool GetFontCapabilities( vcl::FontCapabilities &rFontCapabilities ) const; - bool HasChar( sal_uInt32 cChar ) const; + const FontCharMapRef GetFontCharMap() const; + bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const; + bool HasChar(sal_uInt32 cChar) const; protected: - Qt5FontFace( const Qt5FontFace& ); - Qt5FontFace( const FontAttributes& rFA, const QString &rFontID ); + Qt5FontFace(const Qt5FontFace&); + Qt5FontFace(const FontAttributes& rFA, const QString& rFontID); private: - const QString m_aFontId; - mutable FontCharMapRef m_xCharMap; - mutable vcl::FontCapabilities m_aFontCapabilities; - mutable bool m_bFontCapabilitiesRead; + const QString m_aFontId; + mutable FontCharMapRef m_xCharMap; + mutable vcl::FontCapabilities m_aFontCapabilities; + mutable bool m_bFontCapabilitiesRead; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index fa28ae55eaf2..3f2ea2da7ba3 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -39,30 +39,30 @@ #include <cairo.h> #include <headless/svpgdi.hxx> -static void SvpDamageHandler( void *handle, - sal_Int32 nExtentsX, sal_Int32 nExtentsY, - sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight ) +static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExtentsY, + sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) { - Qt5Frame* pThis = static_cast< Qt5Frame* >( handle ); - pThis->Damage( nExtentsX, nExtentsY, nExtentsWidth, nExtentsHeight ); + Qt5Frame* pThis = static_cast<Qt5Frame*>(handle); + pThis->Damage(nExtentsX, nExtentsY, nExtentsWidth, nExtentsHeight); } -Qt5Frame::Qt5Frame( Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo ) - : m_bUseCairo( bUseCairo ) - , m_bGraphicsInUse( false ) - , m_ePointerStyle( PointerStyle::Arrow ) - , m_bDefaultSize( true ) - , m_bDefaultPos( true ) +Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) + : m_bUseCairo(bUseCairo) + , m_bGraphicsInUse(false) + , m_ePointerStyle(PointerStyle::Arrow) + , m_bDefaultSize(true) + , m_bDefaultPos(true) { - Qt5Instance *pInst = static_cast<Qt5Instance*>( GetSalData()->m_pInstance ); - pInst->insertFrame( this ); + Qt5Instance* pInst = static_cast<Qt5Instance*>(GetSalData()->m_pInstance); + pInst->insertFrame(this); m_aDamageHandler.handle = this; m_aDamageHandler.damaged = ::SvpDamageHandler; - if( nStyle & SalFrameStyleFlags::DEFAULT ) // ensure default style + if (nStyle & SalFrameStyleFlags::DEFAULT) // ensure default style { - nStyle |= SalFrameStyleFlags::MOVEABLE | SalFrameStyleFlags::SIZEABLE | SalFrameStyleFlags::CLOSEABLE; + nStyle |= SalFrameStyleFlags::MOVEABLE | SalFrameStyleFlags::SIZEABLE + | SalFrameStyleFlags::CLOSEABLE; nStyle &= ~SalFrameStyleFlags::FLOAT; } @@ -70,131 +70,127 @@ Qt5Frame::Qt5Frame( Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo m_pParent = pParent; Qt::WindowFlags aWinFlags; - if ( !(nStyle & SalFrameStyleFlags::SYSTEMCHILD) ) + if (!(nStyle & SalFrameStyleFlags::SYSTEMCHILD)) { - if( nStyle & SalFrameStyleFlags::INTRO ) + if (nStyle & SalFrameStyleFlags::INTRO) aWinFlags |= Qt::SplashScreen; - else if( nStyle & (SalFrameStyleFlags::FLOAT | - SalFrameStyleFlags::TOOLTIP) ) + else if (nStyle & (SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLTIP)) aWinFlags |= Qt::ToolTip; - else if( (nStyle & SalFrameStyleFlags::FLOAT) && - ! (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION) ) + else if ((nStyle & SalFrameStyleFlags::FLOAT) + && !(nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION)) aWinFlags |= Qt::Popup; - else if( nStyle & SalFrameStyleFlags::DIALOG && pParent ) + else if (nStyle & SalFrameStyleFlags::DIALOG && pParent) aWinFlags |= Qt::Dialog; - else if( nStyle & SalFrameStyleFlags::TOOLWINDOW ) + else if (nStyle & SalFrameStyleFlags::TOOLWINDOW) aWinFlags |= Qt::Tool; - else if( (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION) ) + else if ((nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION)) aWinFlags |= Qt::Window | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus; else aWinFlags |= Qt::Window; } - m_pQWidget.reset( new Qt5Widget( *this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags ) ); + m_pQWidget.reset(new Qt5Widget(*this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags)); if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG)) { - QWindow *pParentWindow = pParent->GetQWidget()->window()->windowHandle(); - QWindow *pChildWindow = m_pQWidget->window()->windowHandle(); - if ( pParentWindow != pChildWindow ) - pChildWindow->setTransientParent( pParentWindow ); + QWindow* pParentWindow = pParent->GetQWidget()->window()->windowHandle(); + QWindow* pChildWindow = m_pQWidget->window()->windowHandle(); + if (pParentWindow != pChildWindow) + pChildWindow->setTransientParent(pParentWindow); } } Qt5Frame::~Qt5Frame() { - Qt5Instance *pInst = static_cast<Qt5Instance*>( GetSalData()->m_pInstance ); - pInst->eraseFrame( this ); + Qt5Instance* pInst = static_cast<Qt5Instance*>(GetSalData()->m_pInstance); + pInst->eraseFrame(this); } -void Qt5Frame::Damage( sal_Int32 nExtentsX, sal_Int32 nExtentsY, - sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) const +void Qt5Frame::Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, + sal_Int32 nExtentsHeight) const { - m_pQWidget->update( nExtentsX, nExtentsY, nExtentsWidth, nExtentsHeight ); + m_pQWidget->update(nExtentsX, nExtentsY, nExtentsWidth, nExtentsHeight); } void Qt5Frame::TriggerPaintEvent() { - QSize aSize( m_pQWidget->size() ); - SalPaintEvent aPaintEvt( 0, 0, aSize.width(), aSize.height(), true ); - CallCallback( SalEvent::Paint, &aPaintEvt ); + QSize aSize(m_pQWidget->size()); + SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height(), true); + CallCallback(SalEvent::Paint, &aPaintEvt); } -void Qt5Frame::TriggerPaintEvent( QRect aRect ) +void Qt5Frame::TriggerPaintEvent(QRect aRect) { - SalPaintEvent aPaintEvt( aRect.x(), aRect.y(), - aRect.width(), aRect.height(), true ); - CallCallback( SalEvent::Paint, &aPaintEvt ); + SalPaintEvent aPaintEvt(aRect.x(), aRect.y(), aRect.width(), aRect.height(), true); + CallCallback(SalEvent::Paint, &aPaintEvt); } SalGraphics* Qt5Frame::AcquireGraphics() { - if( m_bGraphicsInUse ) + if (m_bGraphicsInUse) return nullptr; m_bGraphicsInUse = true; - if( m_bUseCairo ) + if (m_bUseCairo) { - if( !m_pSvpGraphics.get() ) + if (!m_pSvpGraphics.get()) { int width = m_pQWidget->size().width(); int height = m_pQWidget->size().height(); - m_pSvpGraphics.reset( new SvpSalGraphics() ); - m_pSurface.reset( cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height )); - m_pSvpGraphics->setSurface( m_pSurface.get(), basegfx::B2IVector(width, height) ); - cairo_surface_set_user_data( m_pSurface.get(), SvpSalGraphics::getDamageKey(), - &m_aDamageHandler, nullptr ); + m_pSvpGraphics.reset(new SvpSalGraphics()); + m_pSurface.reset(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height)); + m_pSvpGraphics->setSurface(m_pSurface.get(), basegfx::B2IVector(width, height)); + cairo_surface_set_user_data(m_pSurface.get(), SvpSalGraphics::getDamageKey(), + &m_aDamageHandler, nullptr); TriggerPaintEvent(); } return m_pSvpGraphics.get(); } else { - if( !m_pQt5Graphics.get() ) + if (!m_pQt5Graphics.get()) { - m_pQt5Graphics.reset( new Qt5Graphics( this ) ); - m_pQImage.reset( new QImage( m_pQWidget->size(), Qt5_DefaultFormat32 ) ); - m_pQt5Graphics->ChangeQImage( m_pQImage.get() ); + m_pQt5Graphics.reset(new Qt5Graphics(this)); + m_pQImage.reset(new QImage(m_pQWidget->size(), Qt5_DefaultFormat32)); + m_pQt5Graphics->ChangeQImage(m_pQImage.get()); TriggerPaintEvent(); } return m_pQt5Graphics.get(); } } -void Qt5Frame::ReleaseGraphics( SalGraphics* pSalGraph ) +void Qt5Frame::ReleaseGraphics(SalGraphics* pSalGraph) { - (void) pSalGraph; - if( m_bUseCairo ) - assert( pSalGraph == m_pSvpGraphics.get() ); + (void)pSalGraph; + if (m_bUseCairo) + assert(pSalGraph == m_pSvpGraphics.get()); else - assert( pSalGraph == m_pQt5Graphics.get() ); + assert(pSalGraph == m_pQt5Graphics.get()); m_bGraphicsInUse = false; } -bool Qt5Frame::PostEvent( ImplSVEvent* pData ) +bool Qt5Frame::PostEvent(ImplSVEvent* pData) { - Qt5Instance *pInst = static_cast<Qt5Instance*>( GetSalData()->m_pInstance ); - pInst->PostEvent( this, pData, SalEvent::UserEvent ); + Qt5Instance* pInst = static_cast<Qt5Instance*>(GetSalData()->m_pInstance); + pInst->PostEvent(this, pData, SalEvent::UserEvent); return true; } -void Qt5Frame::SetTitle( const OUString& rTitle ) +void Qt5Frame::SetTitle(const OUString& rTitle) { - m_pQWidget->window()->setWindowTitle( toQString( rTitle ) ); + m_pQWidget->window()->setWindowTitle(toQString(rTitle)); } -void Qt5Frame::SetIcon( sal_uInt16 nIcon ) +void Qt5Frame::SetIcon(sal_uInt16 nIcon) { - if( m_nStyle & (SalFrameStyleFlags::PLUG | - SalFrameStyleFlags::SYSTEMCHILD | - SalFrameStyleFlags::FLOAT | - SalFrameStyleFlags::INTRO | - SalFrameStyleFlags::OWNERDRAWDECORATION) - || !m_pQWidget->isWindow() ) + if (m_nStyle & (SalFrameStyleFlags::PLUG | SalFrameStyleFlags::SYSTEMCHILD + | SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::INTRO + | SalFrameStyleFlags::OWNERDRAWDECORATION) + || !m_pQWidget->isWindow()) return; - const char * appicon; + const char* appicon; if (nIcon == SV_ICON_ID_TEXT) appicon = "libreoffice-writer"; @@ -211,91 +207,83 @@ void Qt5Frame::SetIcon( sal_uInt16 nIcon ) else appicon = "libreoffice-startcenter"; - QIcon aIcon = QIcon::fromTheme( appicon ); - m_pQWidget->window()->setWindowIcon( aIcon ); + QIcon aIcon = QIcon::fromTheme(appicon); + m_pQWidget->window()->setWindowIcon(aIcon); } -void Qt5Frame::SetMenu( SalMenu* pMenu ) -{ -} +void Qt5Frame::SetMenu(SalMenu* pMenu) {} -void Qt5Frame::DrawMenuBar() -{ -} +void Qt5Frame::DrawMenuBar() {} -void Qt5Frame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) -{ -} +void Qt5Frame::SetExtendedFrameStyle(SalExtStyle nExtStyle) {} -void Qt5Frame::Show( bool bVisible, bool bNoActivate ) +void Qt5Frame::Show(bool bVisible, bool bNoActivate) { - assert( m_pQWidget.get() ); - m_pQWidget->setVisible( bVisible ); + assert(m_pQWidget.get()); + m_pQWidget->setVisible(bVisible); } -void Qt5Frame::SetMinClientSize( long nWidth, long nHeight ) +void Qt5Frame::SetMinClientSize(long nWidth, long nHeight) { - if( ! isChild() ) - m_pQWidget->setMinimumSize( nWidth, nHeight ); + if (!isChild()) + m_pQWidget->setMinimumSize(nWidth, nHeight); } -void Qt5Frame::SetMaxClientSize( long nWidth, long nHeight ) +void Qt5Frame::SetMaxClientSize(long nWidth, long nHeight) { - if( ! isChild() ) - m_pQWidget->setMaximumSize( nWidth, nHeight ); + if (!isChild()) + m_pQWidget->setMaximumSize(nWidth, nHeight); } void Qt5Frame::Center() { - if ( m_pParent ) + if (m_pParent) { - QWidget *pWindow = m_pParent->GetQWidget()->window(); - m_pQWidget->move( - pWindow->frameGeometry().topLeft() + - pWindow->rect().center() - m_pQWidget->rect().center() ); + QWidget* pWindow = m_pParent->GetQWidget()->window(); + m_pQWidget->move(pWindow->frameGeometry().topLeft() + pWindow->rect().center() + - m_pQWidget->rect().center()); } } Size Qt5Frame::CalcDefaultSize() { - assert( m_pQWidget->isWindow() ); - QScreen *pScreen = m_pQWidget->windowHandle()->screen(); - if( !pScreen ) + assert(m_pQWidget->isWindow()); + QScreen* pScreen = m_pQWidget->windowHandle()->screen(); + if (!pScreen) return Size(); - return bestmaxFrameSizeForScreenSize( toSize( pScreen->size() ) ); + return bestmaxFrameSizeForScreenSize(toSize(pScreen->size())); } void Qt5Frame::SetDefaultSize() { Size aDefSize = CalcDefaultSize(); - SetPosSize( 0, 0, aDefSize.Width(), aDefSize.Height(), - SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); + SetPosSize(0, 0, aDefSize.Width(), aDefSize.Height(), + SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT); } -void Qt5Frame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) +void Qt5Frame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags) { - if( !m_pQWidget->isWindow() || isChild( true, false ) ) + if (!m_pQWidget->isWindow() || isChild(true, false)) return; - - if( (nFlags & ( SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT )) && - (nWidth > 0 && nHeight > 0 ) // sometimes stupid things happen - ) + if ((nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) + && (nWidth > 0 && nHeight > 0) // sometimes stupid things happen + ) { m_bDefaultSize = false; - if( isChild( false ) || !m_pQWidget->isMaximized() ) + if (isChild(false) || !m_pQWidget->isMaximized()) { - m_pQWidget->resize( nWidth, nHeight ); + m_pQWidget->resize(nWidth, nHeight); } } - else if( m_bDefaultSize ) + else if (m_bDefaultSize) SetDefaultSize(); m_bDefaultSize = false; - if( nFlags & ( SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ) ) + if (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) { - if( m_pParent ) + if (m_pParent) { QRect aRect = m_pParent->GetQWidget()->geometry(); nX += aRect.x(); @@ -303,92 +291,87 @@ void Qt5Frame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt } m_bDefaultPos = false; - m_pQWidget->move( nX, nY ); + m_pQWidget->move(nX, nY); } - else if( m_bDefaultPos ) + else if (m_bDefaultPos) Center(); m_bDefaultPos = false; } -void Qt5Frame::GetClientSize( long& rWidth, long& rHeight ) +void Qt5Frame::GetClientSize(long& rWidth, long& rHeight) { rWidth = m_pQWidget->width(); rHeight = m_pQWidget->height(); } -void Qt5Frame::GetWorkArea( tools::Rectangle& rRect ) +void Qt5Frame::GetWorkArea(tools::Rectangle& rRect) { - if( !m_pQWidget->isWindow() ) + if (!m_pQWidget->isWindow()) return; - QScreen *pScreen = m_pQWidget->windowHandle()->screen(); - if( !pScreen ) + QScreen* pScreen = m_pQWidget->windowHandle()->screen(); + if (!pScreen) return; QSize aSize = pScreen->availableVirtualSize(); - rRect = tools::Rectangle( 0, 0, aSize.width(), aSize.height() ); + rRect = tools::Rectangle(0, 0, aSize.width(), aSize.height()); } -SalFrame* Qt5Frame::GetParent() const -{ - return m_pParent; -} +SalFrame* Qt5Frame::GetParent() const { return m_pParent; } -void Qt5Frame::SetWindowState( const SalFrameState* pState ) +void Qt5Frame::SetWindowState(const SalFrameState* pState) { - if( !m_pQWidget->isWindow() || !pState || isChild( true, false ) ) + if (!m_pQWidget->isWindow() || !pState || isChild(true, false)) return; - const WindowStateMask nMaxGeometryMask = - WindowStateMask::X | WindowStateMask::Y | - WindowStateMask::Width | WindowStateMask::Height | - WindowStateMask::MaximizedX | WindowStateMask::MaximizedY | - WindowStateMask::MaximizedWidth | WindowStateMask::MaximizedHeight; + const WindowStateMask nMaxGeometryMask + = WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width | WindowStateMask::Height + | WindowStateMask::MaximizedX | WindowStateMask::MaximizedY + | WindowStateMask::MaximizedWidth | WindowStateMask::MaximizedHeight; - if( (pState->mnMask & WindowStateMask::State) && - (pState->mnState & WindowStateState::Maximized) && - (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask ) + if ((pState->mnMask & WindowStateMask::State) && (pState->mnState & WindowStateState::Maximized) + && (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask) m_pQWidget->showMaximized(); - else if( pState->mnMask & (WindowStateMask::X | WindowStateMask::Y | - WindowStateMask::Width | WindowStateMask::Height ) ) + else if (pState->mnMask & (WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width + | WindowStateMask::Height)) { sal_uInt16 nPosSizeFlags = 0; QPoint aPos = m_pQWidget->pos(); QPoint aParentPos; - if( m_pParent ) + if (m_pParent) aParentPos = m_pParent->GetQWidget()->window()->pos(); long nX = pState->mnX - aParentPos.x(); long nY = pState->mnY - aParentPos.y(); - if( pState->mnMask & WindowStateMask::X ) + if (pState->mnMask & WindowStateMask::X) nPosSizeFlags |= SAL_FRAME_POSSIZE_X; else nX = aPos.x() - aParentPos.x(); - if( pState->mnMask & WindowStateMask::Y ) + if (pState->mnMask & WindowStateMask::Y) nPosSizeFlags |= SAL_FRAME_POSSIZE_Y; else nY = aPos.y() - aParentPos.y(); - if( pState->mnMask & WindowStateMask::Width ) + if (pState->mnMask & WindowStateMask::Width) nPosSizeFlags |= SAL_FRAME_POSSIZE_WIDTH; - if( pState->mnMask & WindowStateMask::Height ) + if (pState->mnMask & WindowStateMask::Height) nPosSizeFlags |= SAL_FRAME_POSSIZE_HEIGHT; - SetPosSize( nX, nY, pState->mnWidth, pState->mnHeight, nPosSizeFlags ); + SetPosSize(nX, nY, pState->mnWidth, pState->mnHeight, nPosSizeFlags); } - else if( pState->mnMask & WindowStateMask::State && ! isChild() ) + else if (pState->mnMask & WindowStateMask::State && !isChild()) { - if( (pState->mnState & WindowStateState::Minimized) && m_pQWidget->isWindow() ) + if ((pState->mnState & WindowStateState::Minimized) && m_pQWidget->isWindow()) m_pQWidget->showMinimized(); else m_pQWidget->showNormal(); } } -bool Qt5Frame::GetWindowState( SalFrameState* pState ) +bool Qt5Frame::GetWindowState(SalFrameState* pState) { pState->mnState = WindowStateState::Normal; - pState->mnMask = WindowStateMask::State; - if( m_pQWidget->isMinimized() || !m_pQWidget->windowHandle() ) + pState->mnMask = WindowStateMask::State; + if (m_pQWidget->isMinimized() || !m_pQWidget->windowHandle()) pState->mnState |= WindowStateState::Minimized; - else if( m_pQWidget->isMaximized() ) + else if (m_pQWidget->isMaximized()) { pState->mnState |= WindowStateState::Maximized; } @@ -399,147 +382,89 @@ bool Qt5Frame::GetWindowState( SalFrameState* pState ) pState->mnY = rect.y(); pState->mnWidth = rect.width(); pState->mnHeight = rect.height(); - pState->mnMask |= WindowStateMask::X | - WindowStateMask::Y | - WindowStateMask::Width | - WindowStateMask::Height; + pState->mnMask |= WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width + | WindowStateMask::Height; } - return true; } -void Qt5Frame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) -{ -} +void Qt5Frame::ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) {} -void Qt5Frame::StartPresentation( bool bStart ) -{ -} +void Qt5Frame::StartPresentation(bool bStart) {} -void Qt5Frame::SetAlwaysOnTop( bool bOnTop ) -{ -} +void Qt5Frame::SetAlwaysOnTop(bool bOnTop) {} -void Qt5Frame::ToTop( SalFrameToTop nFlags ) -{ -} +void Qt5Frame::ToTop(SalFrameToTop nFlags) {} -void Qt5Frame::SetPointer( PointerStyle ePointerStyle ) +void Qt5Frame::SetPointer(PointerStyle ePointerStyle) { - QWindow *pWindow = m_pQWidget->window()->windowHandle(); - if( !pWindow ) + QWindow* pWindow = m_pQWidget->window()->windowHandle(); + if (!pWindow) return; - if( ePointerStyle == m_ePointerStyle ) + if (ePointerStyle == m_ePointerStyle) return; m_ePointerStyle = ePointerStyle; - pWindow->setCursor( static_cast<Qt5Data*>( GetSalData() )->getCursor( ePointerStyle ) ); + pWindow->setCursor(static_cast<Qt5Data*>(GetSalData())->getCursor(ePointerStyle)); } -void Qt5Frame::CaptureMouse( bool bMouse ) -{ -} +void Qt5Frame::CaptureMouse(bool bMouse) {} -void Qt5Frame::SetPointerPos( long nX, long nY ) -{ -} +void Qt5Frame::SetPointerPos(long nX, long nY) {} -void Qt5Frame::Flush() -{ -} +void Qt5Frame::Flush() {} -void Qt5Frame::Flush( const tools::Rectangle& rRect ) -{ -} +void Qt5Frame::Flush(const tools::Rectangle& rRect) {} -void Qt5Frame::SetInputContext( SalInputContext* pContext ) -{ -} +void Qt5Frame::SetInputContext(SalInputContext* pContext) {} -void Qt5Frame::EndExtTextInput( EndExtTextInputFlags nFlags ) -{ -} +void Qt5Frame::EndExtTextInput(EndExtTextInputFlags nFlags) {} -OUString Qt5Frame::GetKeyName( sal_uInt16 nKeyCode ) -{ - return OUString(); -} +OUString Qt5Frame::GetKeyName(sal_uInt16 nKeyCode) { return OUString(); } -bool Qt5Frame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) +bool Qt5Frame::MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType, + vcl::KeyCode& rKeyCode) { return false; } -LanguageType Qt5Frame::GetInputLanguage() -{ - return LANGUAGE_DONTKNOW; -} +LanguageType Qt5Frame::GetInputLanguage() { return LANGUAGE_DONTKNOW; } -void Qt5Frame::UpdateSettings( AllSettings& rSettings ) -{ -} +void Qt5Frame::UpdateSettings(AllSettings& rSettings) {} -void Qt5Frame::Beep() -{ -} +void Qt5Frame::Beep() {} -const SystemEnvData* Qt5Frame::GetSystemData() const -{ - return nullptr; -} +const SystemEnvData* Qt5Frame::GetSystemData() const { return nullptr; } SalFrame::SalPointerState Qt5Frame::GetPointerState() { SalPointerState aState; QPoint pos = QCursor::pos(); - aState.maPos = Point( pos.x(), pos.y() ); - aState.mnState = GetMouseModCode( qApp->mouseButtons() ) | - GetKeyModCode( qApp->keyboardModifiers() ); + aState.maPos = Point(pos.x(), pos.y()); + aState.mnState + = GetMouseModCode(qApp->mouseButtons()) | GetKeyModCode(qApp->keyboardModifiers()); return aState; } -KeyIndicatorState Qt5Frame::GetIndicatorState() -{ - return KeyIndicatorState(); -} +KeyIndicatorState Qt5Frame::GetIndicatorState() { return KeyIndicatorState(); } -void Qt5Frame::SimulateKeyPress( sal_uInt16 nKeyCode ) -{ -} +void Qt5Frame::SimulateKeyPress(sal_uInt16 nKeyCode) {} -void Qt5Frame::SetParent( SalFrame* pNewParent ) -{ - m_pParent = static_cast< Qt5Frame* >( pNewParent ); -} +void Qt5Frame::SetParent(SalFrame* pNewParent) { m_pParent = static_cast<Qt5Frame*>(pNewParent); } -bool Qt5Frame::SetPluginParent( SystemParentData* pNewParent ) -{ - return false; -} +bool Qt5Frame::SetPluginParent(SystemParentData* pNewParent) { return false; } -void Qt5Frame::ResetClipRegion() -{ -} +void Qt5Frame::ResetClipRegion() {} -void Qt5Frame::BeginSetClipRegion( sal_uLong nRects ) -{ -} +void Qt5Frame::BeginSetClipRegion(sal_uLong nRects) {} -void Qt5Frame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ -} +void Qt5Frame::UnionClipRegion(long nX, long nY, long nWidth, long nHeight) {} -void Qt5Frame::EndSetClipRegion() -{ -} +void Qt5Frame::EndSetClipRegion() {} -void Qt5Frame::SetScreenNumber( unsigned int ) -{ -} +void Qt5Frame::SetScreenNumber(unsigned int) {} -void Qt5Frame::SetApplicationID(const OUString &) -{ -} +void Qt5Frame::SetApplicationID(const OUString&) {} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Frame.hxx b/vcl/qt5/Qt5Frame.hxx index 5863c925a83b..b5f31387b3e2 100644 --- a/vcl/qt5/Qt5Frame.hxx +++ b/vcl/qt5/Qt5Frame.hxx @@ -33,106 +33,104 @@ class QPaintDevice; class QImage; class SvpSalGraphics; -class Qt5Frame - : public SalFrame +class Qt5Frame : public SalFrame { friend class Qt5Widget; - std::unique_ptr< QWidget > m_pQWidget; + std::unique_ptr<QWidget> m_pQWidget; - const bool m_bUseCairo; - std::unique_ptr< QImage > m_pQImage; - std::unique_ptr< Qt5Graphics > m_pQt5Graphics; - UniqueCairoSurface m_pSurface; - std::unique_ptr< SvpSalGraphics> m_pSvpGraphics; - DamageHandler m_aDamageHandler; + const bool m_bUseCairo; + std::unique_ptr<QImage> m_pQImage; + std::unique_ptr<Qt5Graphics> m_pQt5Graphics; + UniqueCairoSurface m_pSurface; + std::unique_ptr<SvpSalGraphics> m_pSvpGraphics; + DamageHandler m_aDamageHandler; - bool m_bGraphicsInUse; - SalFrameStyleFlags m_nStyle; - Qt5Frame *m_pParent; - PointerStyle m_ePointerStyle; + bool m_bGraphicsInUse; + SalFrameStyleFlags m_nStyle; + Qt5Frame* m_pParent; + PointerStyle m_ePointerStyle; - bool m_bDefaultSize; - bool m_bDefaultPos; + bool m_bDefaultSize; + bool m_bDefaultPos; - void Center(); - Size CalcDefaultSize(); - void SetDefaultSize(); + void Center(); + Size CalcDefaultSize(); + void SetDefaultSize(); - bool isChild( bool bPlug = true, bool bSysChild = true ) + bool isChild(bool bPlug = true, bool bSysChild = true) { SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE; - if( bPlug ) + if (bPlug) nMask |= SalFrameStyleFlags::PLUG; - if( bSysChild ) + if (bSysChild) nMask |= SalFrameStyleFlags::SYSTEMCHILD; return bool(m_nStyle & nMask); } void TriggerPaintEvent(); - void TriggerPaintEvent( QRect aRect ); + void TriggerPaintEvent(QRect aRect); public: - Qt5Frame( Qt5Frame* pParent, - SalFrameStyleFlags nSalFrameStyle, - bool bUseCairo ); + Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nSalFrameStyle, bool bUseCairo); virtual ~Qt5Frame() override; QWidget* GetQWidget() const { return m_pQWidget.get(); } - void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, - sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) const; - - virtual SalGraphics* AcquireGraphics() override; - virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; - - virtual bool PostEvent(ImplSVEvent* pData) override; - - virtual void SetTitle( const OUString& rTitle ) override; - virtual void SetIcon( sal_uInt16 nIcon ) override; - virtual void SetMenu( SalMenu* pMenu ) override; - virtual void DrawMenuBar() override; - - virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; - virtual void Show( bool bVisible, bool bNoActivate = false ) override; - virtual void SetMinClientSize( long nWidth, long nHeight ) override; - virtual void SetMaxClientSize( long nWidth, long nHeight ) override; - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) override; - virtual void GetClientSize( long& rWidth, long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; - virtual SalFrame* GetParent() const override; - virtual void SetWindowState( const SalFrameState* pState ) override; - virtual bool GetWindowState( SalFrameState* pState ) override; - virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override; - virtual void StartPresentation( bool bStart ) override; - virtual void SetAlwaysOnTop( bool bOnTop ) override; - virtual void ToTop( SalFrameToTop nFlags ) override; - virtual void SetPointer( PointerStyle ePointerStyle ) override; - virtual void CaptureMouse( bool bMouse ) override; - virtual void SetPointerPos( long nX, long nY ) override; - virtual void Flush() override; - virtual void Flush( const tools::Rectangle& rRect ) override; - virtual void SetInputContext( SalInputContext* pContext ) override; - virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override; - virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override; - virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override; - virtual LanguageType GetInputLanguage() override; - virtual void UpdateSettings( AllSettings& rSettings ) override; - virtual void Beep() override; + void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, + sal_Int32 nExtentsHeight) const; + + virtual SalGraphics* AcquireGraphics() override; + virtual void ReleaseGraphics(SalGraphics* pGraphics) override; + + virtual bool PostEvent(ImplSVEvent* pData) override; + + virtual void SetTitle(const OUString& rTitle) override; + virtual void SetIcon(sal_uInt16 nIcon) override; + virtual void SetMenu(SalMenu* pMenu) override; + virtual void DrawMenuBar() override; + + virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override; + virtual void Show(bool bVisible, bool bNoActivate = false) override; + virtual void SetMinClientSize(long nWidth, long nHeight) override; + virtual void SetMaxClientSize(long nWidth, long nHeight) override; + virtual void SetPosSize(long nX, long nY, long nWidth, long nHeight, + sal_uInt16 nFlags) override; + virtual void GetClientSize(long& rWidth, long& rHeight) override; + virtual void GetWorkArea(tools::Rectangle& rRect) override; + virtual SalFrame* GetParent() const override; + virtual void SetWindowState(const SalFrameState* pState) override; + virtual bool GetWindowState(SalFrameState* pState) override; + virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override; + virtual void StartPresentation(bool bStart) override; + virtual void SetAlwaysOnTop(bool bOnTop) override; + virtual void ToTop(SalFrameToTop nFlags) override; + virtual void SetPointer(PointerStyle ePointerStyle) override; + virtual void CaptureMouse(bool bMouse) override; + virtual void SetPointerPos(long nX, long nY) override; + virtual void Flush() override; + virtual void Flush(const tools::Rectangle& rRect) override; + virtual void SetInputContext(SalInputContext* pContext) override; + virtual void EndExtTextInput(EndExtTextInputFlags nFlags) override; + virtual OUString GetKeyName(sal_uInt16 nKeyCode) override; + virtual bool MapUnicodeToKeyCode(sal_Unicode aUnicode, LanguageType aLangType, ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits