summaryrefslogtreecommitdiff
path: root/sw/source/ui/vba/vbasection.cxx
blob: 662e2212740fdb5b07226addd3df8f72aabbd873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*- 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/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#include "vbasection.hxx"
#include <vbahelper/vbahelper.hxx>
#include <tools/diagnose_ex.h>
#include "vbapagesetup.hxx"
#include "vbaheadersfooters.hxx"

using namespace ::ooo::vba;
using namespace ::com::sun::star;

SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw ( uno::RuntimeException ) :
    SwVbaSection_BASE( rParent, rContext ), mxModel( xModel ), mxPageProps( xProps )
{
}

SwVbaSection::~SwVbaSection()
{
}

::sal_Bool SAL_CALL SwVbaSection::getProtectedForForms() throw (uno::RuntimeException)
{
    return sal_False;
}

void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforforms*/ ) throw (uno::RuntimeException)
{
}

uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index ) throw (uno::RuntimeException)
{
    uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_True ) );
    if ( index.hasValue() )
        return xCol->Item( index, uno::Any() );
    return uno::makeAny( xCol );
}

uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index ) throw (uno::RuntimeException)
{
    uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_False ) );
    if ( index.hasValue() )
        return xCol->Item( index, uno::Any() );
    return uno::makeAny( xCol );
}

uno::Any SAL_CALL
SwVbaSection::PageSetup( ) throw (uno::RuntimeException)
{
    return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) );
}

rtl::OUString
SwVbaSection::getServiceImplName()
{
    return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaSection"));
}

uno::Sequence< rtl::OUString >
SwVbaSection::getServiceNames()
{
    static uno::Sequence< rtl::OUString > aServiceNames;
    if ( aServiceNames.getLength() == 0 )
    {
        aServiceNames.realloc( 1 );
        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Section" ) );
    }
    return aServiceNames;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
dac7eb0d 2018-06-30Avoid getTokenCount() + not empty OUString has at least 1 tokenMatteo Casalin Change-Id: Ib8771f9621e050c100f2a319e354106bf316b24c 2018-06-30Copy INetURLObject object instead of constructing it twiceMatteo Casalin Change-Id: Ib20f96fe63218aed4055bd0175ddc9e9c71e3fb3 2018-05-14weld GalleryIdDialogCaolán McNamara Change-Id: I214afef7668eaf5082683f1c77b08aa0c5107619 Reviewed-on: https://gerrit.libreoffice.org/54317 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2018-02-20svx: fix deadlock in Gallery::GetGalleryInstance()Michael Stahl Seen in UITest_writer_tests. Use C++11 thread-safe static initialisation here, which should avoid the deadlock that is caused by relying on osl::Mutex::getGlobalMutex(). Thread #1: 2 in osl_acquireMutex(oslMutexImpl*) (pMutex=0x1ad2c70) at sal/osl/unx/mutex.cxx:97 3 in osl::Mutex::acquire() (this=0x7ff3252b9628 <rtl::Static<osl::Mutex, (anonymous namespace)::theImplHelperInitMutex>::get()::instance>) at include/osl/mutex.hxx:56 4 in osl::Guard<osl::Mutex>::Guard(osl::Mutex&) (this=0x7ffca8bdd6c0, t=...) at include/osl/mutex.hxx:129 5 in cppu::getTypeEntries(cppu::class_data*) (cd=0x7ff31e458fe0 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSink>, com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSink>::operator()()::s_cd>) at cppuhelper/source/implbase_ex.cxx:89 6 in cppu::queryDeepNoXInterface(typelib_TypeDescriptionReference const*, cppu::class_data*, void*) (pDemandedTDR=0x2e643b0, cd=0x7ff31e458fe0 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSink>, com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSink>::operator()()::s_cd>, that=0x387cbe0) at cppuhelper/source/implbase_ex.cxx:173 [...] 20 in utl::UcbStreamHelper::CreateStream(rtl::OUString const&, StreamMode) (rFileName="file://instdir/program/../share/gallery/sounds.thm", eOpenMode=StreamMode::READ) at unotools/source/ucbhelper/ucbstreamhelper.cxx:149 21 in GalleryTheme::CreateThemeEntry(INetURLObject const&, bool) (rURL=..., bReadOnly=false) at svx/source/gallery2/galtheme.cxx:692 22 in Gallery::ImplLoadSubDirs(INetURLObject const&, bool&) (this=0x38762c0, rBaseURL=..., rbDirIsReadOnly=@0x7ffca8bde7df: false) at svx/source/gallery2/gallery1.cxx:474 23 in Gallery::ImplLoad(rtl::OUString const&) (this=0x38762c0, rMultiPath="file://instdir/program/../share/gallery;file://workdir/UITest/writer_tests/user/user/gallery") at svx/source/gallery2/gallery1.cxx:301 24 in Gallery::Gallery(rtl::OUString const&) (this=0x38762c0, rMultiPath="file://instdir/program/../share/gallery;file://workdir/UITest/writer_tests/user/user/gallery") at svx/source/gallery2/gallery1.cxx:257 25 in Gallery::GetGalleryInstance() () at svx/source/gallery2/gallery1.cxx:273 26 in GalleryExplorer::BeginLocking(unsigned int) (nThemeId=3) at svx/source/gallery2/galexpl.cxx:264 27 in SvxBmpNumValueSet::init() (this=0x3873ed0) at svx/source/dialog/svxbmpnumvalueset.cxx:501 Thread #8 Grammar Checking: 2 in osl_acquireMutex(oslMutexImpl*) (pMutex=0x7ff329045420 <globalMutexImpl>) at sal/osl/unx/mutex.cxx:97 3 in osl::Mutex::acquire() (this=0x7ff32903b780 <osl_getGlobalMutex::globalMutex>) at include/osl/mutex.hxx:56 4 in osl::Guard<osl::Mutex>::Guard(osl::Mutex*) (this=0x7ff2f5b30030, pT_=0x7ff32903b780 <osl_getGlobalMutex::globalMutex>) at include/osl/mutex.hxx:122 5 in com::sun::star::container::cppu_detail_getUnoType(com::sun::star::container::XEnumeration const*) () at workdir/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/container/XEnumeration.hpp:69 6 in cppu::UnoType<com::sun::star::container::XEnumeration>::get() () at include/cppu/unotype.hxx:296 7 in cppu::detail::cppu_detail_getUnoType<com::sun::star::container::XEnumeration>(com::sun::star::uno::Reference<com::sun::star::container::XEnumeration> const*) () at include/cppu/unotype.hxx:259 8 in cppu::UnoType<com::sun::star::uno::Reference<com::sun::star::container::XEnumeration> >::get() () at include/cppu/unotype.hxx:296 9 in com::sun::star::reflection::detail::theXTypeDescriptionEnumerationType::operator()() const (this=0x7ff2f5b30177) at workdir/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/reflection/XTypeDescriptionEnumeration.hpp:30 10 in rtl::StaticWithInit<com::sun::star::uno::Type*, com::sun::star::reflection::detail::theXTypeDescriptionEnumerationType, com::sun::star::reflection::detail::theXTypeDescriptionEnumerationType, com::sun::star::uno::Type*>::get() () at include/rtl/instance.hxx:603 11 in com::sun::star::reflection::cppu_detail_getUnoType(com::sun::star::reflection::XTypeDescriptionEnumeration const*) () at workdir/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/reflection/XTypeDescriptionEnumeration.hpp:57 12 in cppu::UnoType<com::sun::star::reflection::XTypeDescriptionEnumeration>::get() () at include/cppu/unotype.hxx:296 13 in com::sun::star::reflection::XTypeDescriptionEnumeration::static_type(void*) () at workdir/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/reflection/XTypeDescriptionEnumeration.hpp:102 14 in cppu::getTypeEntries(cppu::class_data*) (cd=0x7ff3252b8ac0 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::reflection::XTypeDescriptionEnumeration>, com::sun::star::reflection::XTypeDescriptionEnumeration>::operator()()::s_cd>) at cppuhelper/source/implbase_ex.cxx:96 Change-Id: I3aa3167ca8989b3d6be053e1c97f3b7a64bfbfb8 Reviewed-on: https://gerrit.libreoffice.org/49986 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> 2018-02-16ofz#6311 still problems with SdrEdgeObj listening to same obj at start as endCaolán McNamara Change-Id: Ibd80b484788779b73943b28a5f36e51ebcacec30 Reviewed-on: https://gerrit.libreoffice.org/49821 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2018-02-05loplugin:useuniqueptr in GalleryNoel Grandin Change-Id: Ia12805bff0403fe260786360233be677ef91f710 Reviewed-on: https://gerrit.libreoffice.org/49208 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-01-17loplugin:unnecessaryparen extend to delete statementsNoel Grandin Change-Id: Ic4383ea948876a26f791f0e5b0110cef978a26e1 Reviewed-on: https://gerrit.libreoffice.org/48027 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-12-14sal_uIntPtr->sal_uInt32 in GalleryNoel Grandin to match GetId() on class GalleryThemeEntry Change-Id: I81944c7e89fa8c9ca65987901f4d598c042d836c Reviewed-on: https://gerrit.libreoffice.org/46391 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-11-18tdf#113855 Assertion while customizing Bullets and NumberingNoel Grandin can't find an easy way of removing the duplication, even though that BeginLocking() stuff looks ripe for simplification. Change-Id: I97b580b3668381c12b62136ea09772d91ab11eac Reviewed-on: https://gerrit.libreoffice.org/44884 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-11-09rename AvoidConfig to FuzzingCaolán McNamara cause that's what its really used for and a couple of cases are not specifically about avoiding config but avoiding uninteresting disk acccess and what not Change-Id: I4c6454f98388579fcd0bf9798321d30408ab65ee Reviewed-on: https://gerrit.libreoffice.org/44491 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2017-10-23loplugin:includeform: svxStephan Bergmann Change-Id: I4057fe05983fb2b63b592ffd325894c12b9cb5b2 2017-07-27loplugin:constparams in svxNoel Grandin and fix a bug in the plugin itself when calling operator's like the one on std::function<> Change-Id: I1617607107eeff06785c1841f69e13ad2926218e Reviewed-on: https://gerrit.libreoffice.org/40446 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-07-21migrate to boost::gettextCaolán McNamara * all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") * ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching MODULE .mo files * UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui goes from l10n target to normal one, so the res/lang.zips of UI files go away * translation via Translation::get(hrc-define-key, imbued-std::locale) * python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there to keep finding the .hrc file uniform) so magic numbers can go away there * java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation mechanism * en-US res files go away, their strings are now the .hrc keys in the source code * remaining .res files are replaced by .mo files * in .res/.ui-lang-zip files, the old scheme missing translations of strings results in inserting the english original so something can be found, now the standard fallback of using the english original from the source key is used, so partial translations shrink dramatically in size * extract .hrc strings with hrcex which backs onto xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap * extract .ui strings with uiex which backs onto xgettext --add-comments --no-wrap * qtz for gettext translations is generated at runtime as ascii-ified crc32 of content + "|" + msgid * [API CHANGE] remove deprecated binary .res resouce loader related uno apis com::sun::star::resource::OfficeResourceLoader com::sun::star::resource::XResourceBundleLoader com::sun::star::resource::XResourceBundle when translating strings via uno apis com.sun.star.resource.StringResourceWithLocation can continue to be used Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a 2017-06-27loplugin:oncevar in svxNoel Grandin Change-Id: I22a3a13e059ac7d3479f12860564fe3eb1b55e44 Reviewed-on: https://gerrit.libreoffice.org/39282 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-05-19make string translation loading more uniformCaolán McNamara change various ResId classes that use conversion operator to OUString to functions that return a OUString drop various defines drop unnecessary toString calls Change-Id: Ibeccdf2b91a46a2ed5b4b74e6024e301a023bc92 Reviewed-on: https://gerrit.libreoffice.org/37817 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2017-05-15tdf#107845 string resource ids effectively ended up in the gallery formatCaolán McNamara which is a problem since... commit 34f7e618ddd3399d9e7f3998e25545256255d02d Date: Sun Apr 30 17:01:32 2017 +0100 untranslated strings are just strings and recover GALLERY_THEME_HTMLBUTTONS and GALLERY_THEME_DUMMY5 from commit 2d3a9c51055a285a2ac8d45e3ef31d248362589b Date: Mon Jul 2 21:02:19 2012 +0200 hrc cleanup: Remove unused defines Change-Id: I3fa45e4550295b94a6ab0acf9bcd0b25db73e689 Change-Id: Idae2c00f43e2062544f3de22e586bb163864bc03 2017-05-02untranslated strings are just stringsCaolán McNamara removes starmaths InsertCommand in favour of InsertCommandText Change-Id: I5659adcaa28e5b5861d1a1cc5d2afa84009490f6 Reviewed-on: https://gerrit.libreoffice.org/37113 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2017-03-03avoid config and gallery for ppt loader testingCaolán McNamara Change-Id: I3512f4b7551ef79dc0aed564219cef84aad91a2f 2017-01-25loplugin: unnecessary destructor svxNoel Grandin Change-Id: I7feed30eea4f7367943fa2d6e0d75be5ca209068 Reviewed-on: https://gerrit.libreoffice.org/33516 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-01-16new loplugin: useuniqueptr: svxNoel Grandin Change-Id: I0eb3d43d7bcfc491df16a72997a0720a6aec2c5c Reviewed-on: https://gerrit.libreoffice.org/32959 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> 2016-12-05convert DecodeMechanism to scoped enumNoel Grandin Change-Id: I5c56634b1bca8e37fa73d02d2428645301b6c547 2016-10-31loplugin:oncevar in svl..svxNoel Grandin Change-Id: I80b11a7b698de4b84d7a2f4c7dc62b2e4fd8bb01 Reviewed-on: https://gerrit.libreoffice.org/30438 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> 2016-05-12clang-tidy modernize-loop-convert in svxNoel Grandin Change-Id: I09e5243e5dff46ceccef1a707e648ee9cb0c37c5 Reviewed-on: https://gerrit.libreoffice.org/24875 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> 2016-04-18clang-tidy performance-unnecessary-copy-initializationNoel Grandin probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com> 2016-04-18Use const_iterator when possible (svx/gallery2,items,sdr,stbctrls)Julien Nabet Change-Id: Idd8992fcb76c25120202b24a23820d85ca09e434 Reviewed-on: https://gerrit.libreoffice.org/24174 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>