[Libreoffice-commits] core.git: 4 commits - Repository.mk scp2/InstallModule_ooo.mk scp2/source setup_native/source sfx2/source xmlsecurity/qa

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 29 12:56:44 UTC 2016


 Repository.mk                                    |    1 
 scp2/InstallModule_ooo.mk                        |    1 
 scp2/source/ooo/module_classification.scp        |   35 -------------
 setup_native/source/packinfo/packinfo_office.txt |   15 -----
 sfx2/source/view/classificationcontroller.cxx    |   19 ++++++-
 sfx2/source/view/classificationhelper.cxx        |   58 ++++++++++++-----------
 xmlsecurity/qa/unit/signing/signing.cxx          |    2 
 7 files changed, 51 insertions(+), 80 deletions(-)

New commits:
commit f09bcddfa9bd5b2944d70014efe9bc95cfa65047
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 29 13:55:45 2016 +0100

    scp2: move scp2 classification package to AutoInstall
    
    Change-Id: I59afb2302b7fe891a83ca5ce7b12eca322bb7ed7

diff --git a/Repository.mk b/Repository.mk
index 83cfeb0..61173d3 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -824,6 +824,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
 		Pyuno/web \
 		Pyuno/mailmerge \
 	)) \
+	sfx2_classification \
 ))
 
 $(eval $(call gb_Helper_register_packages_for_install,ogltrans,\
diff --git a/scp2/InstallModule_ooo.mk b/scp2/InstallModule_ooo.mk
index 33ca0b0..d54ca2e 100644
--- a/scp2/InstallModule_ooo.mk
+++ b/scp2/InstallModule_ooo.mk
@@ -93,7 +93,6 @@ $(eval $(call gb_InstallModule_add_scpfiles,scp2/ooo,\
 		scp2/source/ooo/mingw_dlls \
 	) \
     scp2/source/ooo/module_filter \
-    scp2/source/ooo/module_classification \
     $(if $(filter-out MACOSX WNT,$(OS)), \
 		scp2/source/ooo/module_libreofficekit \
 	) \
diff --git a/scp2/source/ooo/module_classification.scp b/scp2/source/ooo/module_classification.scp
deleted file mode 100644
index 4f04d26..0000000
--- a/scp2/source/ooo/module_classification.scp
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "macros.inc"
-
-Module gid_Module_Classification
-    Name = "Classification Data";
-    Description = "Classification Data";
-    PackageInfo = "packinfo_office.txt";
-    ParentID = gid_Module_Root_Brand;
-    Styles = (HIDDEN_ROOT);
-    Dirs = (gid_Dir_Share_Classification);
-    Files = (
-        gid_File_Dat_Sfx2ClassificationExample);
-End
-
-Directory gid_Dir_Share_Classification
-    ParentID = gid_Brand_Dir_Share;
-    DosName = "classification";
-End
-
-File gid_File_Dat_Sfx2ClassificationExample
-    TXT_FILE_BODY;
-    Dir = gid_Dir_Share_Classification;
-    Name = "example.xml";
-    Styles = (PACKED);
-End
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt
index 870d5a8..a097481 100644
--- a/setup_native/source/packinfo/packinfo_office.txt
+++ b/setup_native/source/packinfo/packinfo_office.txt
@@ -1163,21 +1163,6 @@ packageversion = "%PACKAGEVERSION"
 End
 
 Start
-module = "gid_Module_Classification"
-solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-classification-data"
-solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core (Name="Core module for %PRODUCTNAME %PRODUCTVERSION")"
-packagename = "%BASISPACKAGEPREFIX%PRODUCTVERSION-classification-data"
-requires = "%BASISPACKAGEPREFIX%PRODUCTVERSION-core %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION"
-linuxpatchrequires = ""
-copyright = "2016 The Document Foundation"
-solariscopyright = "solariscopyrightfile"
-vendor = "The Document Foundation"
-description = "Classification data for %PRODUCTNAME %PRODUCTVERSION"
-destpath = "/opt"
-packageversion = "%PACKAGEVERSION"
-End
-
-Start
 module = "gid_Module_Reportbuilder"
 solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-extension-report-builder"
 solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core (Name="Core module for %PRODUCTNAME %PRODUCTVERSION")"
commit 46b85ee064a87dc4b5e438085f11d5d2efada2d6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 29 11:42:51 2016 +0100

    sfx2 classification toolbar: dispatch uno command on selection change
    
    Change-Id: Iad3cb44cd57ad9e50be6008146629cdca8455eb6

diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
index 85ae658..0e861a1 100644
--- a/sfx2/source/view/classificationcontroller.cxx
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -13,7 +13,6 @@
 
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
-#include <cppuhelper/supportsservice.hxx>
 
 #include <vcl/vclptr.hxx>
 #include <vcl/lstbox.hxx>
@@ -22,6 +21,9 @@
 #include <vcl/toolbox.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/classificationhelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/propertysequence.hxx>
+#include <comphelper/dispatchcommand.hxx>
 
 using namespace com::sun::star;
 
@@ -35,6 +37,8 @@ class ClassificationCategoriesController : public ClassificationCategoriesContro
 {
     VclPtr<ListBox> m_pCategories;
 
+    DECL_LINK_TYPED(SelectHdl, ListBox&, void);
+
 public:
     ClassificationCategoriesController(const uno::Reference<uno::XComponentContext>& rContext);
     virtual ~ClassificationCategoriesController();
@@ -96,11 +100,24 @@ uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindo
     vcl::Window* pParent = VCLUnoHelper::GetWindow(rParent);
     ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent);
     if (pToolbar)
+    {
         m_pCategories = VclPtr<ListBox>::Create(pToolbar, WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_DROPDOWN|WB_SIMPLEMODE);
+        m_pCategories->SetSelectHdl(LINK(this, ClassificationCategoriesController, SelectHdl));
+    }
 
     return uno::Reference<awt::XWindow>(VCLUnoHelper::GetInterface(m_pCategories));
 }
 
+IMPL_LINK_NOARG_TYPED(ClassificationCategoriesController, SelectHdl, ListBox&, void)
+{
+    OUString aEntry = m_pCategories->GetSelectEntry();
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+    {
+        {"Name", uno::makeAny(aEntry)},
+    }));
+    comphelper::dispatchCommand(".uno:ClassificationApply", aPropertyValues);
+}
+
 void ClassificationCategoriesController::statusChanged(const frame::FeatureStateEvent& /*rEvent*/) throw (uno::RuntimeException, std::exception)
 {
     if (!m_pCategories || m_pCategories->GetEntryCount() > 0)
commit c00a0a4fd1f84594e9ead9cad10b96fd7f4beade
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 29 10:47:26 2016 +0100

    sfx2 classification: set toolbar listbox width after inserting entries
    
    This way GetOptimalSize() returns a size that allows reading the
    selected item after selecting one. (The new width is the double of the
    old one, or so.)
    
    Change-Id: I5f935dcbee52844fb325bd74437479f759a85852

diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
index 8c6bd09..85ae658 100644
--- a/sfx2/source/view/classificationcontroller.cxx
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -96,10 +96,7 @@ uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindo
     vcl::Window* pParent = VCLUnoHelper::GetWindow(rParent);
     ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent);
     if (pToolbar)
-    {
         m_pCategories = VclPtr<ListBox>::Create(pToolbar, WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_DROPDOWN|WB_SIMPLEMODE);
-        m_pCategories->SetSizePixel(m_pCategories->GetOptimalSize());
-    }
 
     return uno::Reference<awt::XWindow>(VCLUnoHelper::GetInterface(m_pCategories));
 }
@@ -119,6 +116,7 @@ void ClassificationCategoriesController::statusChanged(const frame::FeatureState
         m_pCategories->InsertEntry(rName);
     // Normally VclBuilder::makeObject() does this.
     m_pCategories->EnableAutoSize(true);
+    m_pCategories->SetSizePixel(m_pCategories->GetOptimalSize());
 }
 
 } // namespace sfx2
commit 900fccc29257d2e226dfcd0fc9ef54f1f5b52ec8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 29 10:21:34 2016 +0100

    sfx2 classification: don't sort items on the toolbar listbox
    
    Assuming the policy follows a least-confidential -> most-confidential
    order, doing a lexicographical sort on the category names does more harm
    than good. So use a vector instead of a name-indexed map for categories.
    
    Also, don't duplicate the label map for the current state, but just
    store the state in the same category structure that is used for other
    (currently not used) categories as well.
    
    Change-Id: I1672192e572abfc22b6aeeb152ee7484086cea91

diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index b07d1ec..f8d7335 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -40,6 +40,7 @@ namespace
 class SfxClassificationCategory
 {
 public:
+    OUString m_aName;
     std::map<OUString, OUString> m_aLabels;
 };
 
@@ -47,7 +48,7 @@ public:
 class SfxClassificationParser : public cppu::WeakImplHelper<xml::sax::XDocumentHandler>
 {
 public:
-    std::map<OUString, SfxClassificationCategory> m_aCategories;
+    std::vector<SfxClassificationCategory> m_aCategories;
 
     OUString m_aPolicyAuthorityName;
     bool m_bInPolicyAuthorityName;
@@ -139,7 +140,9 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception)
             OUString aIdentifier = xAttribs->getValueByName("Identifier");
 
             // Create a new category and initialize it with the data that's true for all categories.
-            SfxClassificationCategory& rCategory = m_aCategories[aName];
+            m_aCategories.push_back(SfxClassificationCategory());
+            SfxClassificationCategory& rCategory = m_aCategories.back();
+            rCategory.m_aName = aName;
             rCategory.m_aLabels["urn:bails:IntellectualProperty:PolicyAuthority:Name"] = m_aPolicyAuthorityName;
             rCategory.m_aLabels["urn:bails:IntellectualProperty:Policy:Name"] = m_aPolicyName;
             rCategory.m_aLabels["urn:bails:IntellectualProperty:BusinessAuthorization:Identifier"] = m_aProgramID;
@@ -282,9 +285,9 @@ void SAL_CALL SfxClassificationParser::setDocumentLocator(const uno::Reference<x
 class SfxClassificationHelper::Impl
 {
 public:
-    std::map<OUString, OUString> m_aLabels;
+    SfxClassificationCategory m_aCategory;
     /// Possible categories of a policy to choose from.
-    std::map<OUString, SfxClassificationCategory> m_aCategories;
+    std::vector<SfxClassificationCategory> m_aCategories;
     SfxObjectShell& m_rObjectShell;
 
     Impl(SfxObjectShell& rObjectShell);
@@ -336,7 +339,7 @@ void SfxClassificationHelper::Impl::pushToObjectShell()
     uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
     uno::Reference<beans::XPropertySet> xPropertySet(xPropertyContainer, uno::UNO_QUERY);
     uno::Sequence<beans::Property> aProperties = xPropertySet->getPropertySetInfo()->getProperties();
-    for (const std::pair<OUString, OUString>& rLabel : m_aLabels)
+    for (const std::pair<OUString, OUString>& rLabel : m_aCategory.m_aLabels)
     {
         try
         {
@@ -388,7 +391,7 @@ SfxClassificationHelper::SfxClassificationHelper(SfxObjectShell& rObjectShell)
         uno::Any aAny = xPropertySet->getPropertyValue(rProperty.Name);
         OUString aValue;
         if (aAny >>= aValue)
-            m_pImpl->m_aLabels[rProperty.Name] = aValue;
+            m_pImpl->m_aCategory.m_aLabels[rProperty.Name] = aValue;
     }
 }
 
@@ -398,8 +401,8 @@ SfxClassificationHelper::~SfxClassificationHelper()
 
 OUString SfxClassificationHelper::GetBACName()
 {
-    std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find("urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name");
-    if (it != m_pImpl->m_aLabels.end())
+    std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find("urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name");
+    if (it != m_pImpl->m_aCategory.m_aLabels.end())
         return it->second;
 
     return OUString();
@@ -407,12 +410,12 @@ OUString SfxClassificationHelper::GetBACName()
 
 bool SfxClassificationHelper::HasImpactLevel()
 {
-    std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find("urn:bails:IntellectualProperty:Impact:Scale");
-    if (it == m_pImpl->m_aLabels.end())
+    std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find("urn:bails:IntellectualProperty:Impact:Scale");
+    if (it == m_pImpl->m_aCategory.m_aLabels.end())
         return false;
 
-    it = m_pImpl->m_aLabels.find("urn:bails:IntellectualProperty:Impact:Level:Confidentiality");
-    if (it == m_pImpl->m_aLabels.end())
+    it = m_pImpl->m_aCategory.m_aLabels.find("urn:bails:IntellectualProperty:Impact:Level:Confidentiality");
+    if (it == m_pImpl->m_aCategory.m_aLabels.end())
         return false;
 
     return true;
@@ -420,8 +423,8 @@ bool SfxClassificationHelper::HasImpactLevel()
 
 bool SfxClassificationHelper::HasDocumentHeader()
 {
-    std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find(SfxClassificationHelper::PROP_DOCHEADER());
-    if (it == m_pImpl->m_aLabels.end() || it->second.isEmpty())
+    std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find(SfxClassificationHelper::PROP_DOCHEADER());
+    if (it == m_pImpl->m_aCategory.m_aLabels.end() || it->second.isEmpty())
         return false;
 
     return true;
@@ -429,8 +432,8 @@ bool SfxClassificationHelper::HasDocumentHeader()
 
 bool SfxClassificationHelper::HasDocumentFooter()
 {
-    std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find(SfxClassificationHelper::PROP_DOCFOOTER());
-    if (it == m_pImpl->m_aLabels.end() || it->second.isEmpty())
+    std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find(SfxClassificationHelper::PROP_DOCFOOTER());
+    if (it == m_pImpl->m_aCategory.m_aLabels.end() || it->second.isEmpty())
         return false;
 
     return true;
@@ -440,13 +443,13 @@ basegfx::BColor SfxClassificationHelper::GetImpactLevelColor()
 {
     basegfx::BColor aRet;
 
-    std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find("urn:bails:IntellectualProperty:Impact:Scale");
-    if (it == m_pImpl->m_aLabels.end())
+    std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find("urn:bails:IntellectualProperty:Impact:Scale");
+    if (it == m_pImpl->m_aCategory.m_aLabels.end())
         return aRet;
     OUString aScale = it->second;
 
-    it = m_pImpl->m_aLabels.find("urn:bails:IntellectualProperty:Impact:Level:Confidentiality");
-    if (it == m_pImpl->m_aLabels.end())
+    it = m_pImpl->m_aCategory.m_aLabels.find("urn:bails:IntellectualProperty:Impact:Level:Confidentiality");
+    if (it == m_pImpl->m_aCategory.m_aLabels.end())
         return aRet;
     OUString aLevel = it->second;
 
@@ -488,8 +491,8 @@ basegfx::BColor SfxClassificationHelper::GetImpactLevelColor()
 
 OUString SfxClassificationHelper::GetDocumentWatermark()
 {
-    std::map<OUString, OUString>::iterator it = m_pImpl->m_aLabels.find(SfxClassificationHelper::PROP_DOCWATERMARK());
-    if (it != m_pImpl->m_aLabels.end())
+    std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find(SfxClassificationHelper::PROP_DOCWATERMARK());
+    if (it != m_pImpl->m_aCategory.m_aLabels.end())
         return it->second;
 
     return OUString();
@@ -501,9 +504,9 @@ std::vector<OUString> SfxClassificationHelper::GetBACNames()
         m_pImpl->parsePolicy();
 
     std::vector<OUString> aRet;
-    std::transform(m_pImpl->m_aCategories.begin(), m_pImpl->m_aCategories.end(), std::back_inserter(aRet), [](const std::pair<OUString, SfxClassificationCategory>& rPair)
+    std::transform(m_pImpl->m_aCategories.begin(), m_pImpl->m_aCategories.end(), std::back_inserter(aRet), [](const SfxClassificationCategory& rCategory)
     {
-        return rPair.first;
+        return rCategory.m_aName;
     });
     return aRet;
 }
@@ -513,14 +516,17 @@ void SfxClassificationHelper::SetBACName(const OUString& rName)
     if (m_pImpl->m_aCategories.empty())
         m_pImpl->parsePolicy();
 
-    std::map<OUString, SfxClassificationCategory>::iterator it = m_pImpl->m_aCategories.find(rName);
+    std::vector<SfxClassificationCategory>::iterator it = std::find_if(m_pImpl->m_aCategories.begin(), m_pImpl->m_aCategories.end(), [&](const SfxClassificationCategory& rCategory)
+    {
+        return rCategory.m_aName == rName;
+    });
     if (it == m_pImpl->m_aCategories.end())
     {
         SAL_WARN("sfx.view", "'" << rName << "' is not a recognized category name");
         return;
     }
 
-    m_pImpl->m_aLabels = it->second.m_aLabels;
+    m_pImpl->m_aCategory.m_aLabels = it->m_aLabels;
     m_pImpl->pushToObjectShell();
     SfxViewFrame* pViewFrame = SfxViewFrame::Current();
     if (!pViewFrame)
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index f3e8d04..d9aec73 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -203,7 +203,7 @@ void SigningTest::testOOXMLPartial()
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
     CPPUNIT_ASSERT_MESSAGE(
         (OString::number(
-            static_cast<std::underlying_type<SignatureState>::type>(nActual))
+             static_cast<std::underlying_type<SignatureState>::type>(nActual))
          .getStr()),
         (nActual == SignatureState::NOTVALIDATED
          || nActual == SignatureState::PARTIAL_OK));


More information about the Libreoffice-commits mailing list