summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-13 11:58:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-13 11:59:01 +0200
commit978ff8f55cfa47b6ced80a6adc3d92327e0303f4 (patch)
tree43012f40d90006fbb8bf9bb45f321b511e211b83 /toolkit
parent53a3e0cd48075011e3c29070e8ff8585c02779c6 (diff)
inline InitGuard
since it is only used in one place Change-Id: Ie541a255ddbe71105f6b58f02f372f4f45667d7a
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/grid/initguard.hxx56
-rw-r--r--toolkit/source/controls/grid/sortablegriddatamodel.cxx18
2 files changed, 14 insertions, 60 deletions
diff --git a/toolkit/source/controls/grid/initguard.hxx b/toolkit/source/controls/grid/initguard.hxx
deleted file mode 100644
index 75d84c0f0c75..000000000000
--- a/toolkit/source/controls/grid/initguard.hxx
+++ /dev/null
@@ -1,56 +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/.
- *
- * 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 .
- */
-
-#ifndef INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_INITGUARD_HXX
-#define INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_INITGUARD_HXX
-
-#include <com/sun/star/lang/NotInitializedException.hpp>
-
-#include <comphelper/componentguard.hxx>
-
-
-namespace toolkit
-{
-
-
- //= InitGuard
-
- template < class IMPL >
- class InitGuard : public ::comphelper::ComponentGuard
- {
- public:
- InitGuard( IMPL& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
- :comphelper::ComponentGuard( i_component, i_broadcastHelper )
- {
- if ( !i_component.isInitialized() )
- throw css::lang::NotInitializedException( OUString(), *&i_component );
- }
-
- ~InitGuard()
- {
- }
- };
-
-
-} // namespace toolkit
-
-
-#endif // INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_INITGUARD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
index af7898d07554..59463e8696b5 100644
--- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
@@ -17,13 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "initguard.hxx"
-
#include <com/sun/star/i18n/Collator.hpp>
#include <com/sun/star/i18n/XCollator.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/NotInitializedException.hpp>
#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
@@ -33,6 +32,7 @@
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/anycompare.hxx>
+#include <comphelper/componentguard.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <tools/diagnose_ex.h>
@@ -45,12 +45,11 @@ using namespace css::i18n;
using namespace css::lang;
using namespace css::ucb;
using namespace css::uno;
-using namespace toolkit;
namespace {
class SortableGridDataModel;
-typedef InitGuard< SortableGridDataModel > MethodGuard;
+class MethodGuard;
typedef ::cppu::WeakComponentImplHelper < css::awt::grid::XSortableMutableGridDataModel
, css::lang::XServiceInfo
@@ -197,6 +196,17 @@ private:
::std::vector< ::sal_Int32 > m_privateToPublicRowIndex;
};
+class MethodGuard : public ::comphelper::ComponentGuard
+{
+public:
+ MethodGuard( SortableGridDataModel& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :comphelper::ComponentGuard( i_component, i_broadcastHelper )
+ {
+ if ( !i_component.isInitialized() )
+ throw css::lang::NotInitializedException( OUString(), *&i_component );
+ }
+};
+
namespace
{
template< class STLCONTAINER >